diff options
author | David Waern <david.waern@gmail.com> | 2009-11-28 20:15:30 +0000 |
---|---|---|
committer | David Waern <david.waern@gmail.com> | 2009-11-28 20:15:30 +0000 |
commit | fba37778cd3eb564c83f1a35e922b8a0a9f111ea (patch) | |
tree | d8e94dc594415b2b63a268a16c72a9acef917529 /src/Haddock/Interface | |
parent | a5138aa6b3da207b78f2624f0fb41b0de6e8f02a (diff) |
Rename HsDoc back into Doc
Diffstat (limited to 'src/Haddock/Interface')
-rw-r--r-- | src/Haddock/Interface/AttachInstances.hs | 2 | ||||
-rw-r--r-- | src/Haddock/Interface/LexParseRn.hs | 14 | ||||
-rw-r--r-- | src/Haddock/Interface/Parse.y | 26 | ||||
-rw-r--r-- | src/Haddock/Interface/ParseModuleHeader.hs | 4 | ||||
-rw-r--r-- | src/Haddock/Interface/Rename.hs | 6 | ||||
-rw-r--r-- | src/Haddock/Interface/Rn.hs | 8 |
6 files changed, 30 insertions, 30 deletions
diff --git a/src/Haddock/Interface/AttachInstances.hs b/src/Haddock/Interface/AttachInstances.hs index b6d988dc..abc5f053 100644 --- a/src/Haddock/Interface/AttachInstances.hs +++ b/src/Haddock/Interface/AttachInstances.hs @@ -56,7 +56,7 @@ attachInstances ifaces instIfaceMap = mapM attach ifaces attachExport export = return export -lookupInstDoc :: Name -> Interface -> InstIfaceMap -> Maybe (HsDoc Name) +lookupInstDoc :: Name -> Interface -> InstIfaceMap -> Maybe (Doc Name) -- TODO: capture this pattern in a function (when we have streamlined the -- handling of instances) lookupInstDoc name iface ifaceMap = diff --git a/src/Haddock/Interface/LexParseRn.hs b/src/Haddock/Interface/LexParseRn.hs index dc7744c7..fc44cedf 100644 --- a/src/Haddock/Interface/LexParseRn.hs +++ b/src/Haddock/Interface/LexParseRn.hs @@ -23,7 +23,7 @@ import Haddock.Interface.Lex import Haddock.Interface.Parse import Haddock.Interface.Rn import Haddock.Interface.ParseModuleHeader -import Haddock.HsDoc +import Haddock.Doc import Data.Maybe import FastString import GHC @@ -31,7 +31,7 @@ import RdrName data HaddockCommentType = NormalHaddockComment | DocSectionComment -lexParseRnHaddockCommentList :: HaddockCommentType -> GlobalRdrEnv -> [HsDocString] -> ErrMsgM (Maybe (HsDoc Name)) +lexParseRnHaddockCommentList :: HaddockCommentType -> GlobalRdrEnv -> [HsDocString] -> ErrMsgM (Maybe (Doc Name)) lexParseRnHaddockCommentList hty gre docStrs = do docMbs <- mapM (lexParseRnHaddockComment hty gre) docStrs let docs = catMaybes docMbs @@ -41,7 +41,7 @@ lexParseRnHaddockCommentList hty gre docStrs = do _ -> return (Just doc) lexParseRnHaddockComment :: HaddockCommentType -> - GlobalRdrEnv -> HsDocString -> ErrMsgM (Maybe (HsDoc Name)) + GlobalRdrEnv -> HsDocString -> ErrMsgM (Maybe (Doc Name)) lexParseRnHaddockComment hty gre (HsDocString fs) = do let str = unpackFS fs let toks = tokenise str @@ -52,14 +52,14 @@ lexParseRnHaddockComment hty gre (HsDocString fs) = do Nothing -> do tell ["doc comment parse failed: "++str] return Nothing - Just doc -> return (Just (rnHsDoc gre doc)) + Just doc -> return (Just (rnDoc gre doc)) -lexParseRnMbHaddockComment :: HaddockCommentType -> GlobalRdrEnv -> Maybe HsDocString -> ErrMsgM (Maybe (HsDoc Name)) +lexParseRnMbHaddockComment :: HaddockCommentType -> GlobalRdrEnv -> Maybe HsDocString -> ErrMsgM (Maybe (Doc Name)) lexParseRnMbHaddockComment _ _ Nothing = return Nothing lexParseRnMbHaddockComment hty gre (Just d) = lexParseRnHaddockComment hty gre d -- yes, you always get a HaddockModInfo though it might be empty -lexParseRnHaddockModHeader :: GlobalRdrEnv -> GhcDocHdr -> ErrMsgM (HaddockModInfo Name, Maybe (HsDoc Name)) +lexParseRnHaddockModHeader :: GlobalRdrEnv -> GhcDocHdr -> ErrMsgM (HaddockModInfo Name, Maybe (Doc Name)) lexParseRnHaddockModHeader gre mbStr = do let failure = (emptyHaddockModInfo, Nothing) case mbStr of @@ -71,4 +71,4 @@ lexParseRnHaddockModHeader gre mbStr = do tell ["haddock module header parse failed: " ++ mess] return failure Right (info, doc) -> - return (rnHaddockModInfo gre info, Just (rnHsDoc gre doc)) + return (rnHaddockModInfo gre info, Just (rnDoc gre doc)) diff --git a/src/Haddock/Interface/Parse.y b/src/Haddock/Interface/Parse.y index f420c8e4..a5175ddc 100644 --- a/src/Haddock/Interface/Parse.y +++ b/src/Haddock/Interface/Parse.y @@ -12,8 +12,8 @@ module Haddock.Interface.Parse ( ) where import Haddock.Interface.Lex -import Haddock.Types (HsDoc(..)) -import Haddock.HsDoc +import Haddock.Types (Doc(..)) +import Haddock.Doc import HsSyn import RdrName } @@ -45,49 +45,49 @@ import RdrName %% -doc :: { HsDoc RdrName } +doc :: { Doc RdrName } : apara PARA doc { docAppend $1 $3 } | PARA doc { $2 } | apara { $1 } | {- empty -} { DocEmpty } -apara :: { HsDoc RdrName } +apara :: { Doc RdrName } : ulpara { DocUnorderedList [$1] } | olpara { DocOrderedList [$1] } | defpara { DocDefList [$1] } | para { $1 } -ulpara :: { HsDoc RdrName } +ulpara :: { Doc RdrName } : '-' para { $2 } -olpara :: { HsDoc RdrName } +olpara :: { Doc RdrName } : '(n)' para { $2 } -defpara :: { (HsDoc RdrName, HsDoc RdrName) } +defpara :: { (Doc RdrName, Doc RdrName) } : '[' seq ']' seq { ($2, $4) } -para :: { HsDoc RdrName } +para :: { Doc RdrName } : seq { docParagraph $1 } | codepara { DocCodeBlock $1 } -codepara :: { HsDoc RdrName } +codepara :: { Doc RdrName } : '>..' codepara { docAppend (DocString $1) $2 } | '>..' { DocString $1 } -seq :: { HsDoc RdrName } +seq :: { Doc RdrName } : elem seq { docAppend $1 $2 } | elem { $1 } -elem :: { HsDoc RdrName } +elem :: { Doc RdrName } : elem1 { $1 } | '@' seq1 '@' { DocMonospaced $2 } -seq1 :: { HsDoc RdrName } +seq1 :: { Doc RdrName } : PARA seq1 { docAppend (DocString "\n") $2 } | elem1 seq1 { docAppend $1 $2 } | elem1 { $1 } -elem1 :: { HsDoc RdrName } +elem1 :: { Doc RdrName } : STRING { DocString $1 } | '/../' { DocEmphasis (DocString $1) } | URL { DocURL $1 } diff --git a/src/Haddock/Interface/ParseModuleHeader.hs b/src/Haddock/Interface/ParseModuleHeader.hs index eb563656..e74a0aef 100644 --- a/src/Haddock/Interface/ParseModuleHeader.hs +++ b/src/Haddock/Interface/ParseModuleHeader.hs @@ -26,7 +26,7 @@ import Data.Char -- NB. The headers must be given in the order Module, Description, -- Copyright, License, Maintainer, Stability, Portability, except that -- any or all may be omitted. -parseModuleHeader :: String -> Either String (HaddockModInfo RdrName, HsDoc RdrName) +parseModuleHeader :: String -> Either String (HaddockModInfo RdrName, Doc RdrName) parseModuleHeader str0 = let getKey :: String -> String -> (Maybe String,String) @@ -43,7 +43,7 @@ parseModuleHeader str0 = (stabilityOpt,str7) = getKey "Stability" str6 (portabilityOpt,str8) = getKey "Portability" str7 - description1 :: Either String (Maybe (HsDoc RdrName)) + description1 :: Either String (Maybe (Doc RdrName)) description1 = case descriptionOpt of Nothing -> Right Nothing Just description -> case parseHaddockString . tokenise $ description of diff --git a/src/Haddock/Interface/Rename.hs b/src/Haddock/Interface/Rename.hs index 0d678537..80dc7d14 100644 --- a/src/Haddock/Interface/Rename.hs +++ b/src/Haddock/Interface/Rename.hs @@ -146,14 +146,14 @@ renameExportItems :: [ExportItem Name] -> RnM [ExportItem DocName] renameExportItems = mapM renameExportItem -renameDocForDecl :: (Maybe (HsDoc Name), FnArgsDoc Name) -> RnM (Maybe (HsDoc DocName), FnArgsDoc DocName) +renameDocForDecl :: (Maybe (Doc Name), FnArgsDoc Name) -> RnM (Maybe (Doc DocName), FnArgsDoc DocName) renameDocForDecl (mbDoc, fnArgsDoc) = do mbDoc' <- renameMaybeDoc mbDoc fnArgsDoc' <- renameFnArgsDoc fnArgsDoc return (mbDoc', fnArgsDoc') -renameMaybeDoc :: Maybe (HsDoc Name) -> RnM (Maybe (HsDoc DocName)) +renameMaybeDoc :: Maybe (Doc Name) -> RnM (Maybe (Doc DocName)) renameMaybeDoc = mapM renameDoc @@ -161,7 +161,7 @@ renameLDocHsSyn :: LHsDocString -> RnM LHsDocString renameLDocHsSyn = return -renameDoc :: HsDoc Name -> RnM (HsDoc DocName) +renameDoc :: Doc Name -> RnM (Doc DocName) renameDoc d = case d of DocEmpty -> return DocEmpty DocAppend a b -> do diff --git a/src/Haddock/Interface/Rn.hs b/src/Haddock/Interface/Rn.hs index c45b5042..5127e49b 100644 --- a/src/Haddock/Interface/Rn.hs +++ b/src/Haddock/Interface/Rn.hs @@ -1,5 +1,5 @@ -module Haddock.Interface.Rn ( rnHsDoc, rnHaddockModInfo ) where +module Haddock.Interface.Rn ( rnDoc, rnHaddockModInfo ) where import Haddock.Types @@ -11,7 +11,7 @@ import Outputable ( ppr, defaultUserStyle ) rnHaddockModInfo :: GlobalRdrEnv -> HaddockModInfo RdrName -> HaddockModInfo Name rnHaddockModInfo gre (HaddockModInfo desc port stab maint) = - HaddockModInfo (fmap (rnHsDoc gre) desc) port stab maint + HaddockModInfo (fmap (rnDoc gre) desc) port stab maint ids2string :: [RdrName] -> String ids2string [] = [] @@ -20,8 +20,8 @@ ids2string (x:_) = show $ ppr x defaultUserStyle data Id x = Id {unId::x} instance Monad Id where (Id v)>>=f = f v; return = Id -rnHsDoc :: GlobalRdrEnv -> HsDoc RdrName -> HsDoc Name -rnHsDoc gre = unId . do_rn +rnDoc :: GlobalRdrEnv -> Doc RdrName -> Doc Name +rnDoc gre = unId . do_rn where do_rn doc_to_rn = case doc_to_rn of |