Suggestion regarding (.) and map
Twan van Laarhoven
twanvl at gmail.com
Thu Apr 24 18:06:58 EDT 2008
Cale Gibbard wrote:
> In keeping with my small but seemingly extremely controversial
> suggestions for changes to the Prelude, here's a suggestion which I
> think is elegant and worth considering for the Haskell' Prelude:
> Rename fmap to map (like it was in Haskell 1.4), and define (.) as a
> synonym for it.
One thing I fear (though that fear may be irrational) is that you get code that
looks like "(.) . ((.) . (.) .)". To me, and I expect to many people, map and
composition are different things, and used in different ways. If both are
written as a dot it will take extra mental effort to decipher the meaning of a
program. The potential for writing code that resembles the worst outputs of the
@pl lambdabot plugin also becomes larger.
Cale: do you have some real world examples of code you wrote using (.) = fmap?
Secondly, I am really fond of the Applicative notation <$>, which goes great
together with <*>. A lighter notation would be nice, but I see no good way to do
that. (Perhaps we need to add syntactic sugar for idiom brackets?)
More information about the Haskell-prime