summaryrefslogtreecommitdiff
path: root/compiler/parser/HaddockUtils.hs
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2014-11-21 11:20:06 -0600
committerAustin Seipp <austin@well-typed.com>2014-11-21 11:26:10 -0600
commit7927658ed1dcf557c7dd78e4b9844100521391c8 (patch)
tree16a5978453233ba0889af5fa3e59a60b42bc0bfc /compiler/parser/HaddockUtils.hs
parentcfa574cea30b411080de5d641309bdf135ed9be5 (diff)
downloadhaskell-7927658ed1dcf557c7dd78e4b9844100521391c8.tar.gz
AST changes to prepare for API annotations, for #9628
Summary: AST changes to prepare for API annotations Add locations to parts of the AST so that API annotations can then be added. The outline of the whole process is captured here https://ghc.haskell.org/trac/ghc/wiki/GhcAstAnnotations This change updates the haddock submodule. Test Plan: sh ./validate Reviewers: austin, simonpj, Mikolaj Reviewed By: simonpj, Mikolaj Subscribers: thomie, goldfire, carter Differential Revision: https://phabricator.haskell.org/D426 GHC Trac Issues: #9628
Diffstat (limited to 'compiler/parser/HaddockUtils.hs')
-rw-r--r--compiler/parser/HaddockUtils.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/parser/HaddockUtils.hs b/compiler/parser/HaddockUtils.hs
index bf22cd77c1..387cbf8f08 100644
--- a/compiler/parser/HaddockUtils.hs
+++ b/compiler/parser/HaddockUtils.hs
@@ -9,13 +9,15 @@ import Control.Monad
-- -----------------------------------------------------------------------------
-- Adding documentation to record fields (used in parsing).
-addFieldDoc :: ConDeclField a -> Maybe LHsDocString -> ConDeclField a
-addFieldDoc fld doc = fld { cd_fld_doc = cd_fld_doc fld `mplus` doc }
+addFieldDoc :: LConDeclField a -> Maybe LHsDocString -> LConDeclField a
+addFieldDoc (L l fld) doc
+ = L l (fld { cd_fld_doc = cd_fld_doc fld `mplus` doc })
-addFieldDocs :: [ConDeclField a] -> Maybe LHsDocString -> [ConDeclField a]
+addFieldDocs :: [LConDeclField a] -> Maybe LHsDocString -> [LConDeclField a]
addFieldDocs [] _ = []
addFieldDocs (x:xs) doc = addFieldDoc x doc : xs
+
addConDoc :: LConDecl a -> Maybe LHsDocString -> LConDecl a
addConDoc decl Nothing = decl
addConDoc (L p c) doc = L p ( c { con_doc = con_doc c `mplus` doc } )