5 Nov
2003
5 Nov
'03
3:55 p.m.
One thing that bugs me about the named record syntax, is that with a datatype: data T = T { t_f1 :: X, t_f2 :: X }; the function t_f1 has the type of an "accessor", ie t_f1 :: T -> X but there doesn't any tidy way to get at the "mutator" function t_f1' :: X -> T -> T without actually having to write the following t_f1' x t = t{t_f1=x} Or is there? Actually mutators of the general form t_f1' :: (X->X) -> T -> T t_f1_ f t = t{t_f1=f (t_f1 t)}