aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/GhcUtils.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Haddock/GhcUtils.hs')
-rw-r--r--src/Haddock/GhcUtils.hs16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/Haddock/GhcUtils.hs b/src/Haddock/GhcUtils.hs
index 5c481586..c0d6707c 100644
--- a/src/Haddock/GhcUtils.hs
+++ b/src/Haddock/GhcUtils.hs
@@ -90,10 +90,18 @@ isVarSym = isLexVarSym . occNameFS
getMainDeclBinder :: HsDecl name -> Maybe name
getMainDeclBinder (TyClD d) = Just (tcdName d)
-getMainDeclBinder (ValD d)
- = case collectHsBindBinders d of
- [] -> Nothing
- (name:_) -> Just name
+getMainDeclBinder (ValD d) =
+#if __GLASGOW_HASKELL__ == 612
+ case collectAcc d [] of
+ [] -> Nothing
+ (name:_) -> Just (unLoc name)
+#else
+ case collectHsBindBinders d of
+ [] -> Nothing
+ (name:_) -> Just name
+#endif
+
+
getMainDeclBinder (SigD d) = sigNameNoLoc d
getMainDeclBinder (ForD (ForeignImport name _ _)) = Just (unLoc name)
getMainDeclBinder (ForD (ForeignExport _ _ _)) = Nothing