diff options
author | Christiaan Baaij <christiaan.baaij@gmail.com> | 2017-06-09 08:26:43 +0200 |
---|---|---|
committer | Alex Biehl <alexbiehl@gmail.com> | 2017-06-09 08:26:43 +0200 |
commit | 87c551fc668b9251f2647cce8772f205e1cee154 (patch) | |
tree | 1ccf05ad324e83a77b21997f2442e890d7d6feb6 /haddock-api/src/Haddock/Interface/Rename.hs | |
parent | d912ee70fff0718440a6f281ccea73aaf8568685 (diff) |
Haddock support for bundled pattern synonyms (#627)
* Haddock support for bundled pattern synonyms
* Add fixities to bundled pattern synonyms
* Add bundled pattern synonyms to the synopsis
* Store bundled pattern fixities in expItemFixities
* Add test for bundled pattern synonyms
* Stop threading fixities
* Include bundled pattern synonyms for re-exported data types
Sadly, fixity information isn't found for re-exported data types
* Support for pattern synonyms
* Modify tests after #631
* Test some reexport variations
* Also lookup bundled pattern synonyms from `InstalledInterface`s
* Check isExported for bundled pattern synonyms
* Pattern synonym is exported check
* Always look for pattern synonyms in the current module
Another overlooked cornercase
* Account for types named twice in export lists
Also introduce a fast function for nubbing on a `Name` and use it
throughout the code base.
* correct fixities for reexported pattern synonyms
* Fuse concatMap and map
* Remove obsolete import
* Add pattern synonyms to visible exports
* Fix test
* Remove corner case
Diffstat (limited to 'haddock-api/src/Haddock/Interface/Rename.hs')
-rw-r--r-- | haddock-api/src/Haddock/Interface/Rename.hs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/haddock-api/src/Haddock/Interface/Rename.hs b/haddock-api/src/Haddock/Interface/Rename.hs index b43860fb..5820c61e 100644 --- a/haddock-api/src/Haddock/Interface/Rename.hs +++ b/haddock-api/src/Haddock/Interface/Rename.hs @@ -55,7 +55,7 @@ renameInterface dflags renamingEnv warnings iface = -- combine the missing names and filter out the built-ins, which would -- otherwise always be missing. - missingNames = nub $ filter isExternalName -- XXX: isExternalName filters out too much + missingNames = nubByName id $ filter isExternalName -- XXX: isExternalName filters out too much (missingNames1 ++ missingNames2 ++ missingNames3 ++ missingNames4 ++ missingNames5) @@ -314,6 +314,11 @@ renameInstHead InstHead {..} = do renameLDecl :: LHsDecl Name -> RnM (LHsDecl DocName) renameLDecl (L loc d) = return . L loc =<< renameDecl d +renamePats :: [(HsDecl Name,DocForDecl Name)] -> RnM [(HsDecl DocName,DocForDecl DocName)] +renamePats = mapM + (\(d,doc) -> do { d' <- renameDecl d + ; doc' <- renameDocForDecl doc + ; return (d',doc')}) renameDecl :: HsDecl Name -> RnM (HsDecl DocName) renameDecl decl = case decl of @@ -601,15 +606,16 @@ renameExportItem item = case item of ExportGroup lev id_ doc -> do doc' <- renameDoc doc return (ExportGroup lev id_ doc') - ExportDecl decl doc subs instances fixities splice -> do + ExportDecl decl pats doc subs instances fixities splice -> do decl' <- renameLDecl decl + pats' <- renamePats pats doc' <- renameDocForDecl doc subs' <- mapM renameSub subs instances' <- forM instances renameDocInstance fixities' <- forM fixities $ \(name, fixity) -> do name' <- lookupRn name return (name', fixity) - return (ExportDecl decl' doc' subs' instances' fixities' splice) + return (ExportDecl decl' pats' doc' subs' instances' fixities' splice) ExportNoDecl x subs -> do x' <- lookupRn x subs' <- mapM lookupRn subs |