simplifying user hooks (non-backward-compatible)

Isaac Jones ijones at
Sat Dec 10 17:32:50 EST 2005

Andres Loeh proposed simplifying the hooks interface now that they've
grown to include not only pre-and-post hooks, but also er, "during"
hooks too.  That is, all of the actions are hooks now (preConf,
confHooks, postConf).

So we could now get rid of the pre and post hooks, as long as the user
could call to the default hooks thusly:

myHooks = defaultUserHooks { confHook = myConf }
myConf pd cf = do myPreConf
                  lbi <- confHook defaultUserHooks
                  myPostConf pd cf lbi

(for suitable myPreConf and myPostConf functions)

This would greatly simplify the Distribution.Simple.UserHooks
structure bringing it from 34 fields to 14 fields, or so.

Downsides: Making pre and post hooks would now be slightly harder, and
it would break existing hooks-using code.

I like it.  What are your feelings?



More information about the Libraries mailing list