[Haskell-cafe] Manual constructor specialization

David Benbennick dbenbenn at gmail.com
Tue Oct 9 11:35:29 EDT 2007


On 10/9/07, Johan Tibell <johan.tibell at gmail.com> wrote:
> data Rope = Empty
>           | Leaf
>           | Node !Rope !Rope

> The point is that Empty
> can only appear at the top by construction

How about indicating this in your data type?  I.e.,

data Rope = Empty | NonEmptyRope
data NonEmptyRope = Leaf | Node !NonEmptyRope !NonEmptyRope


More information about the Haskell-Cafe mailing list