August 2018
Intermediate to advanced
380 pages
10h 2m
English
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 ...