[Haskell-cafe] Re: Why is $ right associative instead ofleftassociative?

Paul Hudak paul.hudak at yale.edu
Sun Feb 5 20:11:19 EST 2006

Ben Rudiak-Gould wrote:
> Paul Hudak wrote:
>> Minor point, perhaps, but I should mention that : is not special 
>> syntax -- it is a perfectly valid infix constructor.
> But Haskell 98 does treat it specially: you can't import Prelude hiding 
> ((:)), or rebind it locally, or refer to it as Prelude.:. In fact I've 
> always wondered why it was done this way. Can anyone enlighten me?

I think that originally it was because various primitives were defined 
(via "Translations" in the Haskell Report) in terms of lists.  But with 
qualified imports I'm also not sure why this is necessary.

> Of course it might be confusing if it were rebound locally, but no more 
> confusing than the fact that [f x | x <- xs] is not the same as (map f xs).

It's not?  Hmmm... why not?  (At one time list comprehensions were 
another way to write do notation -- i.e. they were both syntactic sugar 
for monads -- in which case these would surely be different, but that's 
not the case in Haskell 98, as far as I know.)


More information about the Haskell-Cafe mailing list