First I would like to remind everyone of Wadler's law of language design: http://www.haskell.org/haskellwiki/Wadlers_Law Having said that I'm now going to argue for yet another color for the bike shed.
I was a little surprised by the list of motivations for changing the fixity of $ because it didn't contain the one argument I was in fact expecting to hear. 0) $ was introduced as a combinator for function application. Therefore we might expect that whenever we have a function application we can stick a $ in there. But this is not the case. Consider the following expression: f x y There are two applications here and if $ behaved like function application we would be able to write: f $ x $ y But as it is now this expression means something completely different. I expected this discrepancy between function application and $ to be the major reason for changing the fixity. That being said, this change would break a lot of my code as well and I'm not a big fan of it. Cheers, Josef On Wed, Apr 23, 2008 at 3:02 AM, Dan Doel <[EMAIL PROTECTED]> wrote: > On Tuesday 22 April 2008, Simon Marlow wrote: > > I'm hoping someone will supply some. There seemed to be strong opinion > > on #haskell that this change should be made, but it might just have been > > a very vocal minority. > > These are the arguments off the top of my head: > > 1) Anything of the form: > > f $ g $ h $ x > > with right associative ($) can instead be written: > > f . g . h $ x > > where the associativity of ($) doesn't matter. It's not uncommon to want to > peel off the end of such a pipeline to eliminate a point. For the second > form, such a translation is: > > \x -> f . g . h $ x ==> f . g . h > > However: > > \x -> f $ g $ h $ x ==> f $ g $ h > > Is invalid, so one might argue that writing such pipelines with composition > is > a better habit to get into, as it allows easier cleanup of code in this way > (if you like somewhat point-free code, that is). > > 2) Left associative ($) allows you to eliminate more parentheses. Per #1, any > parentheses eliminated by right associative ($) can be eliminated by (.) and > a single ($). However, left associative ($) allows, for instance: > > f (g x) (h y) ==> f $ g x $ h y > > 3) Left associative ($) is consistent with left associative ($!). The right > associative version of the latter is inconvenient, because it only allows > things to be (easily) strictly applied to the last argument of a function. > Needing to strictly apply to other arguments gives rise to things like: > > (f $! x) y z > ((f $! x) $! y) $! z > > Left associative, these are: > > f $! x $ y $ z > f $! x $! y $! z > > There may be more arguments, but those are the ones I've heard that I can > think of at the moment. #3 strikes me as the most likely to bite people (the > other two are more stylistic issues), but I suppose I don't know the relative > frequency of strict pipelines (f $! g $! x) versus strict applications at > non-final arguments. > > And I suppose one has to weigh these arguments against breaking lots of code. > > Cheers, > -- Dan > > > _______________________________________________ > Haskell-prime mailing list > Haskell-prime@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-prime > _______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime