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 "classic monads" and "new monads" explicit and using deriving-via, we can eliminate the boilerplate.
Resources:
- GitHub repository with code for the episode: github.com/wel...
- Release notes for GHC 7.10.1: downloads.hask...
- Original Mastodon post by Martín Escardó: mathstodon.xyz...
- DerivingVia paper by Baldur Blöndal, Andres Löh and Ryan Scott: ryanglscott.gi...
Негізгі бет The Haskell Unfolder Episode 16: monads and deriving via
No video
Пікірлер: 7