diff options
author | Simon Marlow <marlowsd@gmail.com> | 2010-06-30 12:45:17 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2010-06-30 12:45:17 +0000 |
commit | 29e0275bfb3442fcd354075ba5bee09e84503099 (patch) | |
tree | 743d508ec78533e98288f9a906113172dc45790f /src/Haddock/Utils.hs | |
parent | 3924891dc47a96e13707489b4e55b3fe8d1ce1d7 (diff) |
LaTeX backend (new options: --latex, --latex-style=<style>)
Diffstat (limited to 'src/Haddock/Utils.hs')
-rw-r--r-- | src/Haddock/Utils.hs | 6 |
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 |