diff options
Diffstat (limited to 'src/Haddock/GhcUtils.hs')
-rw-r--r-- | src/Haddock/GhcUtils.hs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/Haddock/GhcUtils.hs b/src/Haddock/GhcUtils.hs index 2fb8c8a3..fc04351b 100644 --- a/src/Haddock/GhcUtils.hs +++ b/src/Haddock/GhcUtils.hs @@ -20,6 +20,7 @@ import Data.Version import Control.Applicative ( (<$>) ) import Control.Arrow import Data.Foldable hiding (concatMap) +import Data.Function import Data.Traversable import Distribution.Compat.ReadP import Distribution.Text @@ -77,7 +78,7 @@ isVarSym = isLexVarSym . occNameFS getMainDeclBinder :: HsDecl name -> [name] -getMainDeclBinder (TyClD d) = [tcdName d] +getMainDeclBinder (TyClD d) | not (isFamInstDecl d) = [tcdName d] getMainDeclBinder (ValD d) = case collectHsBindBinders d of [] -> [] @@ -141,6 +142,11 @@ isInstD (TyClD d) = isFamInstDecl d isInstD _ = False +isValD :: HsDecl a -> Bool +isValD (ValD _) = True +isValD _ = False + + declATs :: HsDecl a -> [a] declATs (TyClD d) | isClassDecl d = map (tcdName . unL) $ tcdATs d declATs _ = [] @@ -167,6 +173,10 @@ reL :: a -> Located a reL = L undefined +before :: Located a -> Located a -> Bool +before = (<) `on` getLoc + + instance Foldable (GenLocated l) where foldMap f (L _ x) = f x @@ -253,7 +263,7 @@ modifySessionDynFlags f = do -- | A variant of 'gbracket' where the return value from the first computation -- is not required. gbracket_ :: ExceptionMonad m => m a -> m b -> m c -> m c -gbracket_ before after thing = gbracket before (const after) (const thing) +gbracket_ before_ after thing = gbracket before_ (const after) (const thing) ------------------------------------------------------------------------------- |