diff options
Diffstat (limited to 'haddock-api/src/Haddock/Interface/AttachInstances.hs')
| -rw-r--r-- | haddock-api/src/Haddock/Interface/AttachInstances.hs | 16 | 
1 files changed, 9 insertions, 7 deletions
| diff --git a/haddock-api/src/Haddock/Interface/AttachInstances.hs b/haddock-api/src/Haddock/Interface/AttachInstances.hs index 1eb227b9..0e5811b1 100644 --- a/haddock-api/src/Haddock/Interface/AttachInstances.hs +++ b/haddock-api/src/Haddock/Interface/AttachInstances.hs @@ -19,14 +19,13 @@ import Haddock.Types  import Haddock.Convert  import Haddock.GhcUtils +import Control.Applicative  import Control.Arrow hiding ((<+>))  import Data.List  import Data.Ord (comparing) -import Data.Function (on)  import Data.Maybe ( maybeToList, mapMaybe, fromMaybe )  import qualified Data.Map as Map  import qualified Data.Set as Set -import Control.Monad  import Class  import DynFlags @@ -35,7 +34,6 @@ import ErrUtils  import FamInstEnv  import FastString  import GHC -import GhcMonad (withSession)  import InstEnv  import MonadUtils (liftIO)  import Name @@ -118,13 +116,17 @@ attachToExportItem index expInfo iface ifaceMap instIfaceMap export =        return $ e { expItemInstances = insts }      e -> return e    where -    attachFixities e@ExportDecl{ expItemDecl = L _ d } = e { expItemFixities = -      nubBy ((==) `on` fst) $ expItemFixities e ++ +    attachFixities e@ExportDecl{ expItemDecl = L _ d +                               , expItemPats = patsyns +                               } = e { expItemFixities = +      nubByName fst $ expItemFixities e ++        [ (n',f) | n <- getMainDeclBinder d -              , Just subs <- [instLookup instSubMap n iface ifaceMap instIfaceMap] -              , n' <- n : subs +              , Just subs <- [instLookup instSubMap n iface ifaceMap instIfaceMap <|> Just []] +              , n' <- n : (subs ++ patsyn_names)                , Just f <- [instLookup instFixMap n' iface ifaceMap instIfaceMap]        ] } +      where +        patsyn_names = concatMap (getMainDeclBinder . fst) patsyns      attachFixities e = e      -- spanName: attach the location to the name that is the same file as the instance location | 
