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


_______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to