[Haskell-cafe] :, infix operator, infix constructor, et cetera

Andrew Coppin andrewcoppin at btinternet.com
Sun Aug 26 08:35:33 EDT 2007


Isaac Dupree wrote:
> Andrew Coppin wrote:
>> Daniel C. Bastos wrote:
>> But that won't compile, because it doesn't obey the syntax rules of 
>> Haskell. You could, however, write
>>
>>  data List x = x : (List x) | End
>>
>> and it would work.
>>
>>  1 : (2 : (3 : End))
>
> Except that (for no particularly good reason) ":" is a reserved symbol 
> that always refers to the Prelude list version.  You could define a 
> similar name like:

Really? That's interesting... AFAIK, according to the Report, it 
shouldn't be.

I just tested. GHC won't let me, WinHugs will. Hmm...



More information about the Haskell-Cafe mailing list