July 2023
Intermediate to advanced
670 pages
17h 13m
English
GADTs give us the ability to build up types alongside the values at the term level. In a sense, each GADT constructor is a function from its term level arguments to the type that the constructor returns. Type classes let us go the other direction, taking the type level information that we’ve built up with GADTs and generating new term level values. In this section, we’ll look at how you can use type classes alongside GADTs to get better type safety between different parts of your application.
We’ll start by continuing with the ShellCmd type that you built in the last section. Let’s imagine that we want to build an application that will let us create a set of pre-defined shell scripts that we’ve validated ...
Read now
Unlock full access