4 ms·
You can derive these implementations from the recursion principle for your type: data Maybe a = Nothing | Just a foldMaybe :: (Unit -> r) -> (a -> r) -> M
by solomonb 2y ago
You can derive these implementations from the recursion principle for your type:
data Maybe a = Nothing | Just a
foldMaybe :: (Unit -> r) -> (a -> r) -> Maybe a -> r
The two higher order functions passed into `foldMaybe` are your `Nothing` and `Just` (modulo I added the Unit param to the Nothing case to be a little more precise).
- gugagore 2y agoIf you have any light to shed, I'm wondering about inductive data types and their expressive necessity here: https://news.ycombinator.com/item?id=42166709 https://news.ycombinator.com/item?id=42166709