[Haskell-cafe] On to applicative

Brandon S Allbery KF8NH allbery at ece.cmu.edu
Tue Aug 31 16:35:13 EDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 8/31/10 13:27 , michael rice wrote:
> So it's a type constructor, not a type? Could you please provide a simple
> example of its usage?

Assuming you don't mean the trivial use in defining functions, see
Control.Monad.Instances:

> instance Functor ((->) r) where
>         fmap = (.)
> 
> instance Monad ((->) r) where
>         return = const
>         f >>= k = \ r -> k (f r) r

(The above is the primitive reader functor/monad, see Control.Monad.Reader
for more information.)

- -- 
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/

iEYEARECAAYFAkx9Z4EACgkQIn7hlCsL25WgrwCgvFQlObavv1fNOaKDjB/qbk8t
8+IAoLUrenXFzZFfJoYYvSy00uPctnaE
=ljiY
-----END PGP SIGNATURE-----


More information about the Haskell-Cafe mailing list