From 995d3f9ed418352cb8e341630e7c7655080c1612 Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 24 Apr 2002 15:14:12 +0000 Subject: [haddock @ 2002-04-24 15:14:11 by simonmar] Grok the kind of module headers we use in fptools/libraries, and pass the "portability", "stability", and "maintainer" strings through into the generated HTML. If the module header doesn't match the pattern, then we don't include the info in the HTML. --- src/HaddockUtil.hs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'src/HaddockUtil.hs') diff --git a/src/HaddockUtil.hs b/src/HaddockUtil.hs index 51c31438..8173cedf 100644 --- a/src/HaddockUtil.hs +++ b/src/HaddockUtil.hs @@ -13,12 +13,18 @@ module HaddockUtil ( -- * Filename utilities basename, dirname, splitFilename3, - isPathSeparator, pathSeparator + isPathSeparator, pathSeparator, + + -- * Miscellaneous utilities + die, dieMsg, mapSnd, mapMaybeM ) where import HsSyn -import List (intersect) + +import List ( intersect ) +import IO ( hPutStr, stderr ) +import System -- ----------------------------------------------------------------------------- -- Some Utilities @@ -136,3 +142,19 @@ isPathSeparator ch = #else ch == '/' #endif + +----------------------------------------------------------------------------- +-- misc. + +die :: String -> IO a +die s = hPutStr stderr s >> exitWith (ExitFailure 1) + +dieMsg :: String -> IO a +dieMsg s = getProgName >>= \prog -> die (prog ++ ": " ++ s) + +mapSnd f [] = [] +mapSnd f ((x,y):xs) = (x,f y) : mapSnd f xs + +mapMaybeM :: Monad m => (a -> m b) -> Maybe a -> m (Maybe b) +mapMaybeM f Nothing = return Nothing +mapMaybeM f (Just a) = f a >>= return . Just -- cgit v1.2.3