Frank Atanassow said:
Gustavo Villavicencio wrote:
Hi all,
I am trying to understand the algebraic laws and operators behind a functional expression...
f >>= g \equiv g* . f
in the Kleisli Star context. Is this right?
Yep.
If it is so, can I combine g*.f with a fork for example?
What do you mean by a "fork"?
Jeremy Gibbons in "Conditional in distributive categories", among others, calls fork to the operator typed as f /_\ g : A -> B x C where f : A -> B and g : A -> C. In other literature it is also called split operador: <f,g> So, the question is, if i have f : A -> T B and g : A -> T C where T is a monad, i.e. an endofunctor, can i combine f and g as <f,g> : A -> T (BxC) knowing that T involves side effects?
Regards, Frank
Regards, gustavo
Gustavo Villavicencio wrote:
Frank Atanassow said:
What do you mean by a "fork"?
So, the question is, if i have
f : A -> T B and g : A -> T C
where T is a monad, i.e. an endofunctor, can i combine f and g as
<f,g> : A -> T (BxC)
knowing that T involves side effects?
I guess you are asking: if category C has finite products, and T is a strong monad on C, does the Kleisli category have finite products? The answer, I imagine, is "not in general", but "yes" if the monad is commutative. pair :: (a -> m b) -> (a -> m c) -> (a -> m (b,c)) pair f g a = do b <- f a c <- g a return (b, c) You need to pick an order for the first two actions. I haven't done the proof, though. Regards, Frank
participants (2)
-
Frank Atanassow -
Gustavo Villavicencio