aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Interface/Rename.hs
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2008-07-20 11:21:46 +0000
committerDavid Waern <david.waern@gmail.com>2008-07-20 11:21:46 +0000
commit9f215339900126328ccbdef6527634c34f44d56b (patch)
treeb99a7a8ee4766e0dca86bd2b4153fc838374aeb6 /src/Haddock/Interface/Rename.hs
parentb888192534c7c070647755f1778fa5a55002d87f (diff)
Preparation for rendering instances as separate declarations
We want to be able to render instances as separate declarations. So we remove the Name argument of ExportDecl, since instances are nameless. This patch also contains the first steps needed to gather type family instances and display them in the backend, but the implementation is far from complete. Because of this, we don't actually show the instances yet.
Diffstat (limited to 'src/Haddock/Interface/Rename.hs')
-rw-r--r--src/Haddock/Interface/Rename.hs17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/Haddock/Interface/Rename.hs b/src/Haddock/Interface/Rename.hs
index f6ffd7ab..d9488ac2 100644
--- a/src/Haddock/Interface/Rename.hs
+++ b/src/Haddock/Interface/Rename.hs
@@ -292,6 +292,9 @@ renameDecl d = case d of
ForD d -> do
d' <- renameForD d
return (ForD d')
+ InstD d -> do
+ d' <- renameInstD d
+ return (InstD d')
_ -> error "renameDecl"
@@ -318,11 +321,11 @@ renameTyClD d = case d of
return (TyData x lcontext' lname' ltyvars' typats' k cons' Nothing)
TySynonym lname ltyvars typats ltype -> do
+ lname' <- renameL lname
ltyvars' <- mapM renameLTyVarBndr ltyvars
ltype' <- renameLType ltype
typats' <- mapM (mapM renameLType) typats
- -- We skip type patterns here as well.
- return (TySynonym (keepL lname) ltyvars' typats' ltype')
+ return (TySynonym lname' ltyvars' typats' ltype')
ClassDecl lcontext lname ltyvars lfundeps lsigs _ ats _ -> do
lcontext' <- renameLContext lcontext
@@ -379,17 +382,23 @@ renameForD (ForeignExport lname ltype x) = do
return (ForeignExport (keepL lname) ltype' x)
+renameInstD (InstDecl ltype _ _ lATs) = do
+ ltype <- renameLType ltype
+ lATs' <- mapM renameLTyClD lATs
+ return (InstDecl ltype emptyBag [] lATs')
+
+
renameExportItem :: ExportItem Name -> RnM (ExportItem DocName)
renameExportItem item = case item of
ExportModule mod -> return (ExportModule mod)
ExportGroup lev id doc -> do
doc' <- renameDoc doc
return (ExportGroup lev id doc')
- ExportDecl x decl doc instances -> do
+ ExportDecl decl doc instances -> do
decl' <- renameLDecl decl
doc' <- mapM renameDoc doc
instances' <- mapM renameInstHead instances
- return (ExportDecl x decl' doc' instances')
+ return (ExportDecl decl' doc' instances')
ExportNoDecl x y subs -> do
y' <- lookupRn id y
subs' <- mapM (lookupRn id) subs