Understanding the Laws of the Land
Haskell functors, applicatives, and monads are more than just the functions given by their type classes. Each of these type classes also come with a set of laws that govern what the implementations should look like. While “laws” might sound rigid and formal, in reality, understanding these laws can be very helpful because they can often lead you to better understanding of how to create instances of these type classes in the first place. Many of these laws originated in pure mathematics, but you don’t need to have a strong math background to follow this section. We’ll walk through all of the laws purely using what you’ve learned about Haskell so far in this book. If you encounter unfamiliar math-y sounding terminology, ...
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