On Thu, Jun 10, 2010 at 10:43 PM, Brandon S. Allbery KF8NH <allb...@ece.cmu.edu> wrote: > 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.)
(<*>) :: Applicative f => f (a -> b) -> f a -> f b (<$>) :: Functor f => (a -> b) -> f a -> f b (<$>) is fmap, not (<*>). (<*>) is available for monads as Control.Monad.ap. Luke _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe