
23 Jun
2005
23 Jun
'05
3:08 p.m.
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