aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Utils.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Haddock/Utils.hs')
-rw-r--r--src/Haddock/Utils.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Haddock/Utils.hs b/src/Haddock/Utils.hs
index 18d56c51..5bdae25f 100644
--- a/src/Haddock/Utils.hs
+++ b/src/Haddock/Utils.hs
@@ -37,6 +37,7 @@ module Haddock.Utils (
-- * List utilities
replace,
+ spanWith,
-- * MTL stuff
MonadIO(..),
@@ -325,6 +326,11 @@ html_xrefs = unsafePerformIO (readIORef html_xrefs_ref)
replace :: Eq a => a -> a -> [a] -> [a]
replace a b = map (\x -> if x == a then b else x)
+spanWith :: (a -> Maybe b) -> [a] -> ([b],[a])
+spanWith p [] = ([],[])
+spanWith p xs@(a:as)
+ | Just b <- p a = let (bs,cs) = spanWith p as in (b:bs,cs)
+ | otherwise = ([],xs)
-----------------------------------------------------------------------------
-- put here temporarily