[Haskell-cafe] Re: How to "Show" an Operation?

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Fri Jun 11 00:43:44 EDT 2010


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] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20100610/a1fbcccc/PGP.bin


More information about the Haskell-Cafe mailing list