diff options
author | davve <davve@dtek.chalmers.se> | 2007-01-05 17:04:11 +0000 |
---|---|---|
committer | davve <davve@dtek.chalmers.se> | 2007-01-05 17:04:11 +0000 |
commit | 0ca30c97b636c3f3c5b35ac1cc5b1102d2126138 (patch) | |
tree | 2101f19b3bfffe3f6a24d8c44dbacbe71ae89c05 /src | |
parent | a962c25635d3f0502d31790a9cf8695e206d93ce (diff) |
Add GHCUtils.hs
Diffstat (limited to 'src')
-rw-r--r-- | src/GHCUtils.hs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/GHCUtils.hs b/src/GHCUtils.hs new file mode 100644 index 00000000..b5448dd4 --- /dev/null +++ b/src/GHCUtils.hs @@ -0,0 +1,15 @@ +module GHCUtils where + +import HsSyn +import SrcLoc + +getMainDeclBinder :: HsDecl name -> Maybe name +getMainDeclBinder (TyClD d) = Just (tcdName 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) +getMainDeclBinder _ = Nothing |