[Haskell-cafe] :, infix operator, infix constructor, et cetera
Isaac Dupree
isaacdupree at charter.net
Sun Aug 26 07:53:51 EDT 2007
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:
data List x = x :- (List x) | End
1 :- (2 :- (3 :- End))
Isaac
More information about the Haskell-Cafe
mailing list