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? 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 might be kind of nice if the list type were actually defined in the Prelude as

    data List a = Nil | a : List a

and all of the special [] syntax defined by a desugaring to this (entirely ordinary) datatype, e.g. [1,2] -> 1 Prelude.: 2 Prelude.: Prelude.Nil.

-- Ben

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to