Make Prelude's map = fmap

Daniel Díaz Casanueva dhelta.diaz at gmail.com
Fri Jun 21 21:00:04 CEST 2013


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> 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
> > 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
> http://www.haskell.org/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20130621/19a7e02f/attachment.htm>


More information about the Libraries mailing list