[commit: haddock] ghc-head, ghc-head1, headdock-library-1.4.5, ie_avails, master, pr/cabal-desc, v2.18, wip/T14529, wip/revert-ttg-2017-11-20, wip/ttg-2017-10-13, wip/ttg-2017-10-31, wip/ttg-2017-11-06, wip/ttg2-2017-11-10, wip/ttg3-2017-11-12, wip/ttg4-constraints-2017-11-13, wip/ttg6-unrevert-2017-11-22: Lookup fixities for reexports without subordinates (#642) (cf7addb)

git at git.haskell.org git at git.haskell.org
Tue Nov 28 11:52:43 UTC 2017


Repository : ssh://git@git.haskell.org/haddock

On branches: ghc-head,ghc-head1,headdock-library-1.4.5,ie_avails,master,pr/cabal-desc,v2.18,wip/T14529,wip/revert-ttg-2017-11-20,wip/ttg-2017-10-13,wip/ttg-2017-10-31,wip/ttg-2017-11-06,wip/ttg2-2017-11-10,wip/ttg3-2017-11-12,wip/ttg4-constraints-2017-11-13,wip/ttg6-unrevert-2017-11-22
Link       : http://git.haskell.org/haddock.git/commitdiff/cf7addb983bd2079b221199f8ec09c8edaeb8956

>---------------------------------------------------------------

commit cf7addb983bd2079b221199f8ec09c8edaeb8956
Author: Alex Biehl <alexbiehl at gmail.com>
Date:   Fri Jun 23 14:44:41 2017 +0200

    Lookup fixities for reexports without subordinates (#642)
    
    So we agree that reexported declarations which do not have subordinates (for example top-level functions) shouldn't have gotten fixities reexported according to the current logic. I wondered why for example Prelude.($) which is obviously reexported from GHC.Base has fixities attached (c.f. http://hackage.haskell.org/package/base-4.9.1.0/docs/Prelude.html#v:-36-).
    
    The reason is this: In mkMaps we lookup all the subordinates of top-level declarations, of course top-level functions don't have subordinates so for them the resulting list is empty. In #644 I established the invariant that there won't be any empty lists in the subordinate map. Without the patch from #642 top-level functions now started to fail reexporting their fixities.


>---------------------------------------------------------------

cf7addb983bd2079b221199f8ec09c8edaeb8956
 haddock-api/src/Haddock/Interface/AttachInstances.hs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/haddock-api/src/Haddock/Interface/AttachInstances.hs b/haddock-api/src/Haddock/Interface/AttachInstances.hs
index 527c6bc..a2cdb75 100644
--- a/haddock-api/src/Haddock/Interface/AttachInstances.hs
+++ b/haddock-api/src/Haddock/Interface/AttachInstances.hs
@@ -18,6 +18,7 @@ import Haddock.Types
 import Haddock.Convert
 import Haddock.GhcUtils
 
+import Control.Applicative
 import Control.Arrow hiding ((<+>))
 import Data.List
 import Data.Ord (comparing)
@@ -119,7 +120,7 @@ attachToExportItem index expInfo iface ifaceMap instIfaceMap export =
                                } = e { expItemFixities =
       nubByName fst $ expItemFixities e ++
       [ (n',f) | n <- getMainDeclBinder d
-              , Just subs <- [instLookup instSubMap n iface ifaceMap instIfaceMap]
+              , Just subs <- [instLookup instSubMap n iface ifaceMap instIfaceMap <|> Just []]
               , n' <- n : (subs ++ patsyn_names)
               , Just f <- [instLookup instFixMap n' iface ifaceMap instIfaceMap]
       ] }



More information about the ghc-commits mailing list