Re:Free monads from scratch
by Iceland_jack on Wednesday June 01, 2022 @10:46AM
(#31582533)
It is possible to derive Applicative.
The next release of GHC is able to derive Applicative for product types: `deriving Applicative via Generically1 F`.
If you have a sum type you can derive Applicative as well, but as you mention there are often multiple options so this requires user assistance: `deriving Applicative via Idiomatically F '[LeftBias Id]`.
The next release of GHC is able to derive Applicative for product types: `deriving Applicative via Generically1 F`.
If you have a sum type you can derive Applicative as well, but as you mention there are often multiple options so this requires user assistance: `deriving Applicative via Idiomatically F '[LeftBias Id]`.
Here is the library that allows that: https://hackage.haskell.org/package/idiomatic