Ticket #101 (closed enhancement: fixed)

Opened 6 years ago

Last modified 5 years ago

Rejig the names of hooks provided by Cabal

Reported by: igloo@… Owned by: ijones
Priority: high Milestone:
Component: Cabal library Version: 1.1.6
Severity: normal Keywords:
Cc: Difficulty: normal
GHC Version: 6.6 Platform: Linux

Description

Currently, if you want add a hook then there seem to be two starting sets of hooks you can use.

One is emptyHooks, but this really is empty. If you use these hooks then setup build will do nothing, for example.

The other is defaultHooks, but this does more than the defaults; for example, it will also run configure.

The actual defaults should be available as a !UserHooks, and a !UserHooks rather than a Maybe !UserHooks should be passed around. At first look, the current code is quite hard to follow.

It would also be nicer if extra hooks could be composed with suitable combinators, e.g.

theRealDefaultHooks :+: runConfigureHooks :+: someOtherHooks

and the extra stuff in defaultHooks was broken up into smaller pieces.

Thanks Ian

Change History

Changed 6 years ago by guest

  • reporter changed from guest to igloo@…

Changed 6 years ago by guest

  • summary changed from Allow the user to get at the actual default hooks to Rejig the names of hooks provided by Cabal

The default hooks are now in theRealDefaultUserHooks.

We should rename the hooks more sensibly, though.

Changed 6 years ago by guest

  • priority changed from normal to high

Changed 5 years ago by duncan

  • status changed from new to closed
  • resolution set to fixed

We currently export:

  • emptyUserHooks which is almost useless.
  • simpleUserHooks which really is the default - it's what defaultMain uses.
  • defaultUserHooks which is not the default. It is now deprecated.
  • autoconfUserHooks which is what defaultUserHooks used to be but with a sensible name and slightly saner behavior.

In principle UserHooks? could be an instance of Monoid. mempty would be emptyUserHooks and mappend could compose actions using >>.

Note: See TracTickets for help on using tickets.