diff options
author | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2014-05-05 05:16:19 +0200 |
---|---|---|
committer | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2014-05-05 09:19:49 +0200 |
commit | 7ac2d0f2d31c2e1c7ede09828f3d5ba5626bd0d4 (patch) | |
tree | 646d89bbeeb15e7e163788d335ccb74b5e3654a2 /src/Haddock/Doc.hs | |
parent | dba02d6df32534aac5d257f2d28596238d248942 (diff) |
Prepare modules for parser split.
We have to generalise the Doc (now DocH) slightly to remove the
dependency on GHC-supplied type.
Diffstat (limited to 'src/Haddock/Doc.hs')
-rw-r--r-- | src/Haddock/Doc.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Haddock/Doc.hs b/src/Haddock/Doc.hs index 55d4e303..d812aee2 100644 --- a/src/Haddock/Doc.hs +++ b/src/Haddock/Doc.hs @@ -12,7 +12,7 @@ import Data.Char (isSpace) -- We put it here so that we can avoid a circular import -- anything relevant imports this module anyway -instance Monoid (Doc id) where +instance Monoid (DocH mod id) where mempty = DocEmpty mappend = docAppend @@ -20,7 +20,7 @@ combineDocumentation :: Documentation name -> Maybe (Doc name) combineDocumentation (Documentation Nothing Nothing) = Nothing combineDocumentation (Documentation mDoc mWarning) = Just (fromMaybe mempty mWarning `mappend` fromMaybe mempty mDoc) -docAppend :: Doc id -> Doc id -> Doc id +docAppend :: DocH mod id -> DocH mod id -> DocH mod id docAppend (DocDefList ds1) (DocDefList ds2) = DocDefList (ds1++ds2) docAppend (DocDefList ds1) (DocAppend (DocDefList ds2) d) = DocAppend (DocDefList (ds1++ds2)) d docAppend (DocOrderedList ds1) (DocOrderedList ds2) = DocOrderedList (ds1 ++ ds2) @@ -34,7 +34,7 @@ docAppend d1 d2 = DocAppend d1 d2 -- again to make parsing easier - we spot a paragraph whose only item -- is a DocMonospaced and make it into a DocCodeBlock -docParagraph :: Doc id -> Doc id +docParagraph :: DocH mod id -> DocH mod id docParagraph (DocMonospaced p) = DocCodeBlock (docCodeBlock p) docParagraph (DocAppend (DocString s1) (DocMonospaced p)) @@ -61,7 +61,7 @@ docParagraph p -- gives an extra vertical space after the code block. The single space -- on the final line seems to trigger the extra vertical space. -- -docCodeBlock :: Doc id -> Doc id +docCodeBlock :: DocH mod id -> DocH mod id docCodeBlock (DocString s) = DocString (reverse $ dropWhile (`elem` " \t") $ reverse s) docCodeBlock (DocAppend l r) |