[Haskell-beginners] Why must inflix constructors begin with a colon?

Norbert Melzer timmelzer at gmail.com
Thu Dec 31 13:42:50 UTC 2015


I'm not a member of the commitee either, but I do think it is to make the
grammar context free and give the parser an easy way to distinguish.
Because of the design as it is now, already a lexer can decide whether we
have a function or an constructor operator.

Francesco Ariis <fa-ml at ariis.it> schrieb am Do., 31. Dez. 2015 14:35:

> On Thu, Dec 31, 2015 at 12:52:44PM +0000, Olumide wrote:
> > I'm new to Haskell and wondering why this restriction?
> >
> > For example (from LYH):
> >
> > infixr 5 :-:
> > data List a = Empty | a :-: (List a) deriving (Show, Read, Eq, Ord)
>
> Not a committee member, but there is a similar restriction (dichotomy,
> rather) with 'functions' (first char lowercase) and 'constructors'
> (first char uppercase), so mirroring it to infix operators/constructors
> seems reasonable.
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20151231/476706be/attachment.html>


More information about the Beginners mailing list