In this episode, we’ll see how deriving-via can be used to capture rules that relate type classes to each other. As a specific example, we will discuss the definition of the Monad type class: ever since this definition was changed back in 2015 in the Applicative Monad Proposal, instantiating Monad to a new datatype requires quite a bit of boilerplate code. By making the relation between
For more details on
DerivingVia
, check out the paper:https://ryanglscott.github.io/papers/deriving-via.pdf
Especially Section 4 which lists many use cases including the superclasses demonstrated in the video.