[project @ 2003-10-13 10:41:43 by simonpj]
authorsimonpj <unknown>
Mon, 13 Oct 2003 10:41:43 +0000 (10:41 +0000)
committersimonpj <unknown>
Mon, 13 Oct 2003 10:41:43 +0000 (10:41 +0000)
Add idIsFrom

ghc/compiler/basicTypes/Id.lhs

index 3b36e58..3d2b4f6 100644 (file)
@@ -30,8 +30,8 @@ module Id (
        isPrimOpId, isPrimOpId_maybe, 
        isFCallId, isFCallId_maybe,
        isDataConWorkId, isDataConWorkId_maybe, 
-       isBottomingId,
-       hasNoBinding,
+       isBottomingId, idIsFrom,
+       hasNoBinding, 
 
        -- Inline pragma stuff
        idInlinePragma, setInlinePragma, modifyInlinePragma, 
@@ -98,10 +98,11 @@ import qualified Demand     ( Demand )
 #endif
 import DataCon         ( isUnboxedTupleCon )
 import NewDemand       ( Demand, StrictSig, topDmd, topSig, isBottomingSig )
-import Name            ( Name, OccName,
+import Name            ( Name, OccName, nameIsLocalOrFrom, 
                          mkSystemName, mkSystemNameEncoded, mkInternalName,
                          getOccName, getSrcLoc
                        ) 
+import Module          ( Module )
 import OccName         ( EncodedFS, mkWorkerOcc )
 import PrimRep         ( PrimRep )
 import FieldLabel      ( FieldLabel )
@@ -295,6 +296,9 @@ isImplicitId id
                -- The dfun id is not an implicit Id; it must *not* be omitted, because 
                -- it carries version info for the instance decl
        other           -> False
+
+idIsFrom :: Module -> Id -> Bool
+idIsFrom mod id = nameIsLocalOrFrom mod (idName id)
 \end{code}
 
 \begin{code}