Debugging Functional Code
Before continuing with the next story, let’s pause for a moment to consider the difficulties and the perks of a functional code base.
If you aren’t convinced yet, you’ll discover soon that writing and debugging higher-order functions and fully functional code can be difficult.
Trying to write all functions as a chain of type transformations, using a single expression and avoiding mutable variables, can make the code quite hard to write. It can be hard to understand how everything fits together and sometimes even why it’s not compiling at all.
On the other hand, once it compiles correctly, we’re usually pretty sure that there will be no surprises later. Once we’re familiar with this style, it’s also surprisingly easy ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access