[<<][haskell][>>][..]
Thu Sep 3 13:40:07 CEST 2015

a -> b -> m c

Is a -> b -> m c a Kleisli arrow?  One would think, because it is
isomorphic to (a,b) -> m c.

Another way to look at this, replacing ordinary function type by
Kleisli arrows:

(a -> m (b -> m c))

Is this isomorphic also?


EDIT: The answer is yes:

tx :: Monad m => (a -> m (b -> m c)) -> (a -> b -> m c)
tx f a b = do; f' <- f a; f' b

The basic idea is that as long as the output is monadic, anything
monadic in the input can always be "pulled out". And doubly wrapped
outputs can always be flattened to singly wrapped, but singly wrapped
outputs are the endpoint.

In general, the conclusion is that inputs are not important.  They are
just parameters that influence the output.  Sounds trivial, but is
actually quite an important guiding principle.



[Reply][About]
[<<][haskell][>>][..]