
23 Jun
2005
23 Jun
'05
3:23 p.m.
On Thu, 23 Jun 2005, Christian Maeder wrote:
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 }
Erm, I have overlooked this, too. So my update function proposal doesn't affect the type aspect of record update syntax.