DrIFT which i am now maintaining can derive such utility functions out of the box. just add a {-!deriving: update -} to get update functions for every labeled field in a datatype. quite useful, I have not updated the web page yet, but the new DrIFT homepage will be at http://homer.netmar.com/~john/computer/haskell/DrIFT/ On Mon, May 06, 2002 at 07:36:30PM +0100, Jorge Adriano wrote:
Anyway I'd prefer to have some way to 'derive' apply and set functions. Something like
data MyData = MyData { foo :: fooType, bar :: ..., .... } deriving (Set, Apply)
Using the keyword "deriving" would probably be a bad idea though :) The set and apply functions could be derived with a standard postfix or maybe prefix... fooAp or apFoo. Maybe we could introduce sintax to specify it...
deriving (Set with "set", Apply with "ap")
I don't know... I'm just brainstorming right now. Having actual functions is important. I don't think I have to explain why to people in this mailing list :-)
Anyway, does such a thing exist, and, if not, is there any chance it could exist, or is it just syntactic salt to too many people? :) I whish you better luck than I've had so far whenever making posts about this same issue ;)
-- --------------------------------------------------------------------------- John Meacham - California Institute of Technology, Alum. - john@foo.net ---------------------------------------------------------------------------