[Haskell-cafe] Why the Prelude must die

Jason Creighton jcreigh at gmail.com
Sun Mar 25 16:26:37 EDT 2007


On Sun, Mar 25, 2007 at 12:59:26AM -0400, ajb at spamcop.net wrote:
> G'day all.
> 
> Quoting Jason Creighton <jcreigh at gmail.com>:
> 
> > Wouldn't this be a non-issue if the "map" in Prelude was fmap?
> 
> It would be a non-issue if a number of things were different, such
> as if Data.Map were a Functor and "map" was the Functor map instead
> of the list map.

Data.Map is a Functor:

http://haskell.org/ghc/docs/latest/html/libraries/base/Data-Map.html#t%3AMap

~$ ghci
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.6, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base ... linking ... done.
Prelude> :m + Data.Map
Prelude Data.Map> fmap (*2) (fromList [(1,2), (3,4)])
fromList [(1,4),(3,8)]

...but perhaps it's not a Functor in some earlier version of the
library?

Jason Creighton


More information about the Haskell-Cafe mailing list