[Haskell-cafe] User data type with operator contructors only

Donald Bruce Stewart dons at cse.unsw.edu.au
Tue Sep 5 08:26:47 EDT 2006


kolar:
> Hello all,
> 
>  my question probably comes from not reading manual properly. But, why 
> is it not possible to have something like:
> 
> infixr 5 :>
> 
> data Stack a
>  = a :> (Stack a)
>  | :||
> 
> And if yes, how can I do that? I know that lists are a hack in Haskell, 

    infixr 5 :>

    data Stack a = a :> (Stack a) | (:||)

    test = 7 :> 8 :> 2 :> (:||)

Not ideal, though, I suppose.

-- Don


More information about the Haskell-Cafe mailing list