[Haskell-cafe] Re: Can we come out of a monad?
Brandon S Allbery KF8NH
allbery at ece.cmu.edu
Fri Jul 30 11:55:38 EDT 2010
-----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. The usual category-theory definition of monads uses the former;
Haskell uses the latter, because it allows operations to easily be chained
together.
- --
brandon s. allbery [linux,solaris,freebsd,perl] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university KF8NH
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkxS9foACgkQIn7hlCsL25Uc2ACgoLG8uti3d0oWrv1H56fRJ3W4
xZIAn1KotatZklktHpKEwdib6AKXrNOr
=Io9w
-----END PGP SIGNATURE-----
More information about the Haskell-Cafe
mailing list