Make Prelude's map = fmap

Andreas Abel andreas.abel at ifi.lmu.de
Fri Jun 21 22:57:14 CEST 2013


Frankly, the proposal text does not make clear what exactly you want to do.

I would guess the name 'fmap' was chosen for 'Functor' because 'map' was 
already taken for lists.  So it would make sense to

1. remove Prelude.map
2. make map an alias for fmap

Then, in 50 years from now we can deprecate fmap and remove it in 100 
years from now. ;-)

Cheers,
Andreas

On 21.06.2013 21:00, Daniel Díaz Casanueva wrote:
> Hello!
>
> To be honest, I always write "fmap" instead of "map" in all my code.
> Sometimes I change the container I am using, and if I write "map", then
> I would have to change that "map" to "Something.map" or just "fmap". I
> know for sure that fmap is going to work in any Functor instance, so I
> don't have to deal with these things. In some situations (using
> functions from other classes as well), I only change the type signature
> of my functions, and the program keeps working as expected, which is
> awesome.
>
> Therefore, I support the proposal.
>
> By the way, how strong is the reason "it would be harder to learn"? Is
> it really that hard to use type classes? I don't think you need any deep
> math to understand how to work with type classes in Haskell. Even if
> they are called "Functor" or "Monad", you don't need to know about
> categories to use them. In fact, any Haskell student faces type classes
> in some point.
>
> In the other hand, I remember that at the beginning somebody showed me
> that "+" sums integers. And eventually, it worked with floats too. He
> called this "overloading" and, presented in that way, type classes
> appeared like something natural in my mind. Can't the same thing been
> done in this case?
>
> Best regards,
> Daniel Díaz.
>
>
> On Fri, Jun 21, 2013 at 11:59 AM, Andrew Butterfield
> <Andrew.Butterfield at scss.tcd.ie <mailto:Andrew.Butterfield at scss.tcd.ie>>
> wrote:
>
>
>     On 21 Jun 2013, at 10:51, Nikita Volkov wrote:
>
>      > Since there's been so many suggestions concerning radically
>     changing the Prelude recently, I'd like to start a poll on a subject.
>      >
>      > I know that "map" is limited to lists for the beginners, but then
>     we're already making a lot of unbeginnerish changes to Prelude. Also
>     it's not a monad transformer, but just a functor - how can a person
>     learn Haskell without understanding what a Functor is?
>
>
>     !!!! No one needs to know what a functor is in order to learn Haskell.
>     No one needs to know any category theory ideas to learn Haskell.
>
>     Haskell is a very good vehicle to introduce such category-theoretic
>     concepts,
>     and as someone learns Haskell, learning about Haskell classes(*)
>     such as Functor,
>     etc, is very important and useful.
>
>     My main reason for this sudden and abrupt response is that I would
>     be worried if
>     any Prelude re-design was predicated on the idea that Haskell
>     beginners need to understand Functors
>       - they don't, but hopefully they will learn...
>
>
>     (*) as distinct from learning about the category theoretic notion of
>     functor.
>
>      >
>      >
>      >
>      > _______________________________________________
>      > Libraries mailing list
>      > Libraries at haskell.org <mailto:Libraries at haskell.org>
>      > http://www.haskell.org/mailman/listinfo/libraries
>
>     --------------------------------------------------------------------
>     Andrew Butterfield     Tel: +353-1-896-2517     Fax: +353-1-677-2204
>     Lero at TCD, Head of Foundations & Methods Research Group
>     Director of Teaching and Learning - Undergraduate,
>     School of Computer Science and Statistics,
>     Room G.39, O'Reilly Institute, Trinity College, University of Dublin
>     http://www.scss.tcd.ie/Andrew.Butterfield/
>     --------------------------------------------------------------------
>
>
>     _______________________________________________
>     Libraries mailing list
>     Libraries at haskell.org <mailto:Libraries at haskell.org>
>     http://www.haskell.org/mailman/listinfo/libraries
>
>
>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>


-- 
Andreas Abel  <><      Du bist der geliebte Mensch.

Theoretical Computer Science, University of Munich
Oettingenstr. 67, D-80538 Munich, GERMANY

andreas.abel at ifi.lmu.de
http://www2.tcs.ifi.lmu.de/~abel/



More information about the Libraries mailing list