Call the original haddockHook with the updated flags rather than the
haddock command.
-- Define CPP __HADDOCK__ macro when running haddock.
haddockHook' p l h f =
do putStrLn ("f=\"" ++ show f ++ "\"")
putStrLn ("g=\"" ++ show g ++ "\"")
haddockHook simpleUserHooks p l h g
where
-- The Haddock flag to pass a flag to GHC to define the macro.
define__HADDOCK__ = ("haddock",["--optghc=-D__HADDOCK__"])
-- Add the flag to the the other flags.
g = f `mappend` emptyHaddockFlags { haddockProgramArgs = [define__HADDOCK__] }
No change in output.
Regards,
Sean