[Haskell-cafe] Re: what is inverse of mzero and return?
Keean Schupke
k.schupke at imperial.ac.uk
Mon Jan 24 14:25:36 EST 2005
Jules Bean wrote:
>
> I've lost track of what you mean by 'this case' and indeed of what you
> mean by 'join' (did you mean mplus? the word join is normally used for
> the operation of type m (m a) -> m a, which is not often used directly
> in haskell)
>
> However, even addressing your point about endofunctors: for two
> endofunctors to be equal, they must be equal on all objects and all
> morphisms, which effectively means they must be pointwise equal on all
> values.
>
> Jules
>
I think the endofunctors are defined on the types, not the values
though. So the object of the category is the endofunctor (Type -> Type),
and unit and join are the identity and binary associative operator on
which a Monad is defined. return and bind are defined in terms of unit
and join. So unit is the identity which when joined to the endofunctor
(Type -> Type) results in the same endofunctor... Therefor:
(Type -> Type) `join` unit => (Type -> Type)
Now as the type of the IO monad is "IO a" we end up with:
(IO a -> IO a) `join` unit => (IO a -> IO a)
This is true irrespective of any side effects IO may have, as the type
is the
same for the IO action no matter what side effects it generates.
At least thats how I understand it...
Keean.
More information about the Haskell-Cafe
mailing list