[Haskell-cafe] type inference and named fields

Christian Maeder maeder at tzi.de
Mon Jun 27 05:40:45 EDT 2005


Malcolm Wallace wrote:
> Christian Maeder <maeder at tzi.de> writes:
> 
>>>voidcast v@(VariantWithOne{}) = v { field1 = Void , field2 = Void }
>>Setting field2 only assures type correctness, but the value of field2
>>would be ignored at runtime.
> 
> Exactly what I was proposing.

I know, but how "save" is this. i.e. when you mistype/exchange field
names?

> I am proposing that it should not be thought of as an error at all.

I think, it is better to get i.e. an overflow error (at runtime) than
another runtime error elsewhere.

Christian


More information about the Haskell-Cafe mailing list