
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?

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@haskell.org http://www.haskell.org/mailman/listinfo/libraries
-------------------------------------------------------------------- Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Lero@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/ --------------------------------------------------------------------

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@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@haskell.org http://www.haskell.org/mailman/listinfo/libraries
-------------------------------------------------------------------- Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Lero@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@haskell.org http://www.haskell.org/mailman/listinfo/libraries

I'd support the map=fmap thing, On Fri, Jun 21, 2013 at 3:00 PM, Daniel Díaz Casanueva < dhelta.diaz@gmail.com> 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@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@haskell.org http://www.haskell.org/mailman/listinfo/libraries
-------------------------------------------------------------------- Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Lero@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@haskell.org http://www.haskell.org/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

On Fri, Jun 21, 2013 at 04:53:49PM -0400, Carter Schonwald wrote:
I'd support the map=fmap thing,
Does it cause any consequences for existing libraries and programs? Does it break any existing Haskell98 (or Haskell2010) code? If not: fine. But if yes: please don't do it. Ciao, Kili

On Fri, 21 Jun 2013, Matthias Kilian wrote:
On Fri, Jun 21, 2013 at 04:53:49PM -0400, Carter Schonwald wrote:
I'd support the map=fmap thing,
Does it cause any consequences for existing libraries and programs? Does it break any existing Haskell98 (or Haskell2010) code?
If not: fine. But if yes: please don't do it.
My main concern is that we reduce type-safety. If you have a lot of nested Functors, and you apply a nested fmap like in (fmap (fmap (fmap f))) with a polymorphic f, then after adding or removing a functor level the code can probably still be compiled, but is wrong. It is also more difficult to read, since in order to understand (fmap (fmap (fmap f))) you have to infer types mentally, in order to find out that, say, the second fmap is a List.map. These are my general concern with always using the most general function available. Thus a -1 for this proposal, from me.

Henning, don't forget that noone suggests to remove Data.List.map, which you will still be perfectly able to use qualified when you feel the need to.
To me having the most general functions imported unqualified from Prelude and specific ones qualified seems most natural. After all, why list should have this "data structure by default" status, why not vector, seq or set or whatever?
On Jun 23, 2013, at 9:46 PM, Henning Thielemann
My main concern is that we reduce type-safety. If you have a lot of nested Functors, and you apply a nested fmap like in (fmap (fmap (fmap f))) with a polymorphic f, then after adding or removing a functor level the code can probably still be compiled, but is wrong. It is also more difficult to read, since in order to understand (fmap (fmap (fmap f))) you have to infer types mentally, in order to find out that, say, the second fmap is a List.map. These are my general concern with always using the most general function available.
Thus a -1 for this proposal, from me.

On Sun, 23 Jun 2013, Nikita Volkov wrote:
Henning, don't forget that noone suggests to remove Data.List.map, which you will still be perfectly able to use qualified when you feel the need to.
If in future Prelude moves more and more to one most general function that does everything given the right type, then I am really concerning to use NoImplicitPrelude in all my modules and use a custom Prelude or none at all.
To me having the most general functions imported unqualified from Prelude
... are you sure, "fmap" is the most general function?
and specific ones qualified seems most natural.

On Jun 23, 2013, at 10:11 PM, Henning Thielemann
If in future Prelude moves more and more to one most general function that does everything given the right type, then I am really concerning to use NoImplicitPrelude in all my modules and use a custom Prelude or none at all.
That's exactly what I am doing now and the very existence of a dozen of "prelude" projects on hackage suggests that I'm hardly alone in that.

On Sun, Jun 23, 2013 at 2:20 PM, Nikita Volkov
If in future Prelude moves more and more to one most general function
On Jun 23, 2013, at 10:11 PM, Henning Thielemann < lemming@henning-thielemann.de> wrote: that does everything given the right type, then I am really concerning to use NoImplicitPrelude in all my modules and use a custom Prelude or none at all.
That's exactly what I am doing now and the very existence of a dozen of "prelude" projects on hackage suggests that I'm hardly alone in that.
Except that most of them are making things *more* general, whereas Henning believes polymorphism is evil and confusing. Is there anything else we need to remove from Haskell to make it "appropriate"? Within the past 24 hours I have heard impassioned arguments for jettisoning polymorphism, monads, and arrows. Maybe strong typing should be removed next? Currying? -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

On Sun, 23 Jun 2013, Brandon Allbery wrote:
On Sun, Jun 23, 2013 at 2:20 PM, Nikita Volkov
wrote: On Jun 23, 2013, at 10:11 PM, Henning Thielemann wrote: > If in future Prelude moves more and more to one most general function that does everything given the right type, then I am really concerning to use NoImplicitPrelude in all my modules and use a custom Prelude or none at all. That's exactly what I am doing now and the very existence of a dozen of "prelude" projects on hackage suggests that I'm hardly alone in that.
Except that most of them are making things *more* general, whereas Henning believes polymorphism is evil and confusing.
I use 'fmap' a lot myself. I only do not see why to alter Prelude, because you can import everything you need from Data.List, Data.Functor and friends.

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
mailto:Andrew.Butterfield@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@haskell.org mailto:Libraries@haskell.org > http://www.haskell.org/mailman/listinfo/libraries
-------------------------------------------------------------------- Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Lero@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@haskell.org mailto:Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@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@ifi.lmu.de http://www2.tcs.ifi.lmu.de/~abel/

I'm not sure what to think about this. The proposal pretty much boils down to removing the "f" from "fmap", which is a *very* minor issue. - Renaming fmap to map will break every single Functor instance so far. - Defining map = fmap will create two functions with the same name and functionality. Taken habit away, people will just define fmaps and use maps. Sounds odd to me, we shouldn't add more DRY than we already have. - <$> is already a pretty useful alias for fmap. Contrary to the "map" synonym, it's canonical use is infix, which I would argue is as much diversity as we could possibly add or need. Therefore, -1 from my side. What I'd be willing to go with is deprecating "map" in favour of using "fmap" everywhere, but my gut tells me others will not like that idea. David

On Fri, Jun 21, 2013 at 4:57 PM, Andreas Abel
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.
About 15 years ago (in Haskell 1.4), 'map' was the name of the method of the Functor class. Then it was changed to 'fmap' and the monomorphic 'map' was added. (Hint: go read the Haskell 1.4 report if you want to see a version of Haskell that is better than the one we have today in a dozen or so ways. :))
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. ;-)
I suspect that is the proposal, although it probably entails getting rid of Data.List.map (and re-exporting the Functor version) as well to not be a significant pain. It is possible to break some things by doing this, but the corner cases involved ought to be pretty rare. -- Dan

This proposal is always loudly shouted down by teachers and textbook authors who want to keep things simple and consistent. While I'm sympathetic, I think they've been going about it the wrong way. I don't care deeply about fmap=map, but I am opposed to preserving the prelude in amber for teaching purposes. Instead, I believe the teachers need to create their own requirements for a beginner's mode, and that we add long-term support for that with a few widely-published features. For example:
{-# LANGUAGE BeginnerMode #-} import BeginnerPrelude
plus a web page at haskell.org that every author could point to that would
detail any changes.
Any book could remain relevant simply by updating a page linked to this
site with relevant updates. These might include changes to the
BeginnerPrelude as well as current help on transitioning from Beginner to
the current full prelude.
On Fri, Jun 21, 2013 at 2:51 AM, Nikita Volkov
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?
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

I'm indifferent; I either use List.map, Map.map etc. for explicitness, or fmap for generality. I'll keep doing this regardless of what Prelude.map is. By the way, not all mappable types can be in Functor, e.g. Set and ByteString. -Isaac
participants (12)
-
Andreas Abel
-
Andrew Butterfield
-
Brandon Allbery
-
Carter Schonwald
-
Clifford Beshers
-
Dan Doel
-
Daniel Díaz Casanueva
-
David Luposchainsky
-
Henning Thielemann
-
Isaac Dupree
-
Matthias Kilian
-
Nikita Volkov