Open Icelandjack opened 7 years ago
From "Monad transformers and modular algebraic effects: What binds them together"
fold :: Functor sig => (a -> b) -> (sig b -> b) -> (Free sig a -> b) fold gen alg (Pure x) = gen x fold gen alg (Free op) = alg (fmap (fold gen alg) op)
fold f g is just a composition of fmap f and iter g right?
fold f g
fmap f
iter g
It's fold gen alg = iter alg . fmap gen, probably not worth it but it makes generator / algebra explicit
fold gen alg = iter alg . fmap gen
From "Monad transformers and modular algebraic effects: What binds them together"