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

Type-level solution to the heterogeneous list problem

The strategy for solving this problem is to encode the guarantees that we want to have in types. We will leverage the highly-developed mechanism of implicit resolution to enforce that guarantee on a certain type. The general idea is to have a guarantee presented by an implicit value. And if we need a certain guarantee about our program, we make our program implicitly depend on the value that represents this guarantee.

The catch is that the application will not compile if the compiler does not find any of the implicits the program depends on. So, by making the program depend on the implicits that represent our guarantees, and making sure these values are present in scope only if the guarantee ...

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