
23 Sep
2003
23 Sep
'03
9:38 a.m.
setFoo :: State -> [Int] -> State setFoo st x = State { foo = x , bar = bar st }
setBar :: State -> [String] -> State setBar st x = State { foo = foo st , bar = x }
It should be sufficient to just write: setFoo st x = st { foo = x } setBar st x = st { bar = x } This creates a new State (out of "st") with an updated field entry without mentioning the other fields. Christian