pattern-matching with labelled types

Tom Pledger Tom.Pledger@peace.com
Fri, 8 Mar 2002 14:52:52 +1300


Andre W B Furtado writes:
 :
 | Of course, it is possible to do something like
 | 
 | > update :: MyType -> Int -> MyType
 | > update mt newValue = MT {x = newValue, y = oldValue}
 | >     where oldValue = y mt
 | 
 | but this really annoys me when MyType has too many fields. Suggestions?

update mt newValue = mt {x = newValue}

HTH.
Tom