Malcolm Wallace wrote:
> I believe this is a very different question from the consecutive
> update one.  

I agree, consecutive and parallel updates are quite different.

> I can see no
> reason to outlaw a type change, where all the relevant types change
> at the same time:
> 
>   update_ok  v@(A{}) = v { one=Void, two=Void }
>   update_ok' v@(A{}) = (\A one two -> A Void Void) v

Because typing fails in your original example:

voidcast [EMAIL PROTECTED] = v {field1 = Void}

What would be the "lambda equivalent"?

> voidcast [EMAIL PROTECTED] =
    (\ (VariantWithOne a) -> VariantWithOne Void) v

would go through. Whereas

> voidcast [EMAIL PROTECTED] = ( \ x -> case x of
     VariantWithTwo a b -> VariantWithTwo Void b
     VariantWithOne a -> VariantWithOne Void) v

fails like the field notation.

I think writing "VariantWithOne {field1 = Void}" instead of
"v {field1 = Void}" is as clear as writing "Right r" again on the rhs
instead of "x" from the pattern "x@(Right r)"

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

Reply via email to