Malcolm Wallace wrote:
>>voidcast :: Fields a -> Fields Void
>>voidcast v@(VariantWithTwo{}) = v { field1 = Void , field2 = Void }
>>voidcast v@(VariantWithOne{}) = v { field1 = Void }

I would not expect that updating only field1 can change the type of v.
The right thing is to construct a new value. This looks as follows with
record syntax:

voidcast VariantWithTwo{} =
    VariantWithTwo { field1 = Void , field2 = Void }
voidcast VariantWithOne{} =
    VariantWithOne { field1 = Void }

Christian
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to