[Haskell-cafe] Re: Can we come out of a monad?

wren ng thornton wren at freegeek.org
Sat Jul 31 00:03:43 EDT 2010


Brandon S Allbery KF8NH wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 7/30/10 11:48 , Ivan Lazar Miljenovic wrote:
>> Ertugrul Soeylemez <es at ertes.de> writes:
>>> it's a bit hidden in Haskell, but a monad instance consists of three
>>> functions:
>>>
>>>   fmap   :: (a -> b) -> (m a -> m b)
>> You don't even need fmap defined for it to be a monad, since fmap f m =
>> liftM f m = m >>= (return . f)
> 
> fmap/join and return/bind are isomorphic; given either set, you can produce
> the other.

No. fmap+join is isomorphic to bind. Your options are (fmap,return,join) 
or (return,bind). There is no way to get by without the return, since 
that's the natural transformation necessary for entering the monad in 
the first place.

-- 
Live well,
~wren


More information about the Haskell-Cafe mailing list