Sat Apr 20 16:29:43 EDT 2019
Lifting in monadic algebraic languages.
Given functor, what would this need?
-- Why are there no generic patterns for this?
c1 f (C ar ai) = do cr <- f ar ; ci <- f ai ; return $ C cr ci
c2 f (C ar ai) (C br bi) = do cr <- f ar br ; ci <- f ai bi ; return $ C cr ci
Basically, the monad is there because of practical reasons
(e.g. strict language), not because of mathematical constraints on the
semantics. This is really unfortunate, but is an artefact of Haskell
So if the monad were not there, this could be fmap and zip. The
second one _adds_ information: the order of operations.
A lot would be solved by implementing some kind of to/from list
operation. Is there a generic way to express that?
Foldable -> toList
but fromlist is not generic.
Traversable and Zip.