projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
30098da
)
getMainDeclBinder should return Nothing for a binding with no variables
author
Simon Marlow
<simonmar@microsoft.com>
Tue, 10 Oct 2006 15:30:23 +0000
(15:30 +0000)
committer
Simon Marlow
<simonmar@microsoft.com>
Tue, 10 Oct 2006 15:30:23 +0000
(15:30 +0000)
See test rn003
compiler/hsSyn/HsUtils.lhs
patch
|
blob
|
history
diff --git
a/compiler/hsSyn/HsUtils.lhs
b/compiler/hsSyn/HsUtils.lhs
index
5d7132e
..
b0978ec
100644
(file)
--- a/
compiler/hsSyn/HsUtils.lhs
+++ b/
compiler/hsSyn/HsUtils.lhs
@@
-428,7
+428,10
@@
collect_pat other acc = acc -- Literals, vars, wildcard
getMainDeclBinder :: HsDecl name -> Maybe name
getMainDeclBinder (TyClD d) = Just (tcdName d)
-getMainDeclBinder (ValD d) = Just ((unLoc . head) (collectAcc d []))
+getMainDeclBinder (ValD d)
+ = case collectAcc d [] of
+ [] -> Nothing -- see rn003
+ (name:_) -> Just (unLoc name)
getMainDeclBinder (SigD d) = sigNameNoLoc d
getMainDeclBinder (ForD (ForeignImport name _ _)) = Just (unLoc name)
getMainDeclBinder (ForD (ForeignExport name _ _)) = Just (unLoc name)