Skip to Content
Mastering Functional Programming
book

Mastering Functional Programming

by Anatolii Kmetiuk
August 2018
Intermediate to advanced
380 pages
10h 2m
English
Packt Publishing
Content preview from Mastering Functional Programming

Laws

Type classes are defined in terms of the methods they support. When defining a type class, you do not have an idea of how exactly the methods will be implemented for every given data type. However, you do have a rough idea of what these methods will do. For example, we have a rough idea that flatMap is responsible for sequential composition, and pure corresponds to lifting a value into an effect type without doing anything else.

This kind of information regarding how the methods should behave can be encapsulated in terms of the mathematical laws that the type class must obey. In fact, the majority of type classes can be viewed from a mathematical perspective, and so there are certain laws that they must obey.

Let's take a look at the ...

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.
Start your free trial

You might also like

Learning Functional Programming

Learning Functional Programming

Jack Widman

Publisher Resources

ISBN: 9781788620796Supplemental Content