aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/GhcUtils.hs
diff options
context:
space:
mode:
authordavid.waern <david.waern@gmail.com>2010-03-18 22:22:27 +0000
committerdavid.waern <david.waern@gmail.com>2010-03-18 22:22:27 +0000
commit629ff801073bb90a968dbc882b0c443d13e4d92e (patch)
tree1c3da3f3263700813ee55c046d00ea1956d4fdd5 /src/Haddock/GhcUtils.hs
parentaccca44fea8b531d27df063f403abbe4303d6ddc (diff)
Fix build with GHC 6.12.1
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