[Haskell-cafe] Why is $ right associative instead of left associative?

Bulat Ziganshin bulatz at HotPOP.com
Mon Feb 6 09:35:24 EST 2006


Hello Henning,

Monday, February 06, 2006, 4:12:44 PM, you wrote:

>> In my opinion all the special syntactic sugar for lists should go
>> away.  I don't think lists are special enough to motivate it.

HT> Fine, someone shares my attitude towards the list sugar. Nevertheless, do
HT> you mean with 'no sugar for lists' also no infix operator for list
HT> construction? I would still like an operator of low precedence for list
HT> construction for writing e.g. (1,'a"):(2,'b'):[].

i prefer to have ":" and "[]" as general collection constructors:

class Collection c a where
  []  :: c a              -- creates empty collection
  (:) :: a -> c a -> c a  -- adds value to the head of collection

and having "default rules" that instatiates this collection type to
list if there is no type signatures and other information what allows
to find proper type of collection constructed this way - just like the
"default Int" language construct defaults all untyped numeric
constants to Int


-- 
Best regards,
 Bulat                            mailto:bulatz at HotPOP.com





More information about the Haskell-prime mailing list