Hi all,
i have a record with a lot of items used in a state monad.
data BigData = BigData {
data1 :: X
, data2 :: X
-- and so on
}
type MonadicEnv a = State BigData a
I updates the fields in the computation with such functions:
updateData1 :: X -> MonadicEnv()
updateData1 d = do; env <- get; put env {data1 = d}
updateData2 :: X -> MonadicEnv()
updateData2 d = do; env <- get; put env {data2 = d}
But it's ugly. Always the same, only the record selector has another
name.
Is it possible to generalize it?
Thanks,
Árpád
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe