[Haskell-cafe] type inference and named fields

Christian Maeder maeder at tzi.de
Mon Jun 27 06:19:55 EDT 2005

Christian Maeder wrote:
> 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?

The criterion should be how "robust" you can program, i.e. can you
easily detect the spots that you must change (or need not to be changed)
when the data type changed? (One of the advantages of Haskell's type system)


More information about the Haskell-Cafe mailing list