Hi,
I agree that a function syntax for a record setter is a really good idea.
Consider for example an cmd line parser that collects flags in
a record. Instead of writing:
opt "l" (NoArg {c_loop=False}) "dont loop",
opt "o" (optStr {c_out=} "dir") "output dir",
opt "t" (optInt {c_maxtime=} "mins") "maximum time"
Just to show that this is a perfect example, see
http://www.cs.york.ac.uk/fp/darcs/yhc-devel/src/compiler98/Flags.hs
which has exactly the kind of problem you mention. Because there is no
setter each line is given as:
Opt "" "lbound" (bf $ \f x -> f{sLBound=x}) "show symbol table
after lambda lifting"
The \f x -> f bit is only there because setters are not first class
thingies. It's not quite as much additional syntax as you have in your
example, but its still not useful.
Thanks
Neil
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe