On Sun, Jan 18, 2009 at 3:23 AM, Andrew Coppin <andrewcop...@btinternet.com>wrote:
> Jonathan Cast wrote: > >> On Sat, 2009-01-17 at 12:04 +0000, Andrew Coppin wrote: >> >> >>> >>> instance (Monad m) => Functor m where >>>> fmap f ma = do a <- ma; return (f a) >>>> >>>> >>> While that's quite interesting from a mathematical point of view, how is >>> this "useful" for programming purposes? >>> >>> >> >> Good Lord. fmap (as above) is *at least* useful enough to be in the >> standard library! (Control.Monad.liftM). >> > > Given that liftM exists, why is having an identical implementation for fmap > useful? Because liftM works on Monads and fmap works on Functors? I believe you can make data that are Functors but are not Monads. > > > The example that leaps out at me is that (>>=) is identical to concatMap > within the list monad. But using lists as a monad is a generally useful > thing to do, and being able to substitute arbitrary monads has obvious > utility. I'm not seeing how being able to treat something that isn't a > container as if it was a container is useful. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe >
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe