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

Generalizing the pattern

Obviously, the pattern we discussed previously is not specific to EitherT. It is something we are frequently going to encounter when dealing with effect types. It is not about Future and Either, but about combining two independent types.

Since this task repeats from effect type to effect type, it was generalized into a pattern. The pattern goes as follows. First, you pick up an effect type that you would like to be combinable with other arbitrary effect types. Then, you define the alternative combinable version of this type. This way, for Either, we have defined a combinable version of it, EitherT.

After that, you define all of the necessary type classes of the given effect type, optionally depending on whatever you ...

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