Hi there. recently I was trying to represent complex data by defining several datatypes and nesting them, such as
data Foo = Foo { foo :: Bar } deriving (Eq,Show) data Bar = Bar { bar :: Int } deriving (Eq,Show) To change only a part of the data, syntactic sugar is quite convenient. But it seems to be quite painful with nested datatypes. b = Bar 10 f = Foo b foobar :: Int -> Foo -> Foo foobar i f = let nb = (foo f){bar = i} in f{foo = nb} So, my question is : is there a nifty way to modify data within a nested datatype, similar to the f{foo = bar} style ? If not, anyone is using some kind of workaround for this ?
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe