On Jun 10, 2010, at 17:38 , Martin Drautzburg wrote:
instance Applicative Named where
   pure x = Named "" x
   (Named s f) <*> (Named t v) = Named (s ++ "(" ++ t ++ ")") (f v)

Applicative. Need to study that

The above is just the Functor, rephrased in Applicative style. <*> is exactly fmap. Likewise, Monad has a function "liftM" which is exactly fmap. (For historical reasons, these are not related the way they should be: all Monads should be Applicatives, all Applicatives should be Functors, and all Functors should be instances of an even more primitive class Pointed.)

According to Hoogle permutations should be in Data.List. Mine (GHCI 6.8.2) does not seem to have it. Seems to have something to do with "base", whatever
that is.

Things have gradually been moving out of base; you probably need to install "containers" from Hackage.

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH


Attachment: PGP.sig
Description: This is a digitally signed message part

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to