[project @ 2003-10-20 18:50:45 by panne]
[ghc-hetmet.git] / ghc / compiler / basicTypes / Id.lhs
index b810376..3d2b4f6 100644 (file)
@@ -30,9 +30,8 @@ module Id (
        isPrimOpId, isPrimOpId_maybe, 
        isFCallId, isFCallId_maybe,
        isDataConWorkId, isDataConWorkId_maybe, 
-       isDataConWrapId, isDataConWrapId_maybe,
-       isBottomingId,
-       hasNoBinding,
+       isBottomingId, idIsFrom,
+       hasNoBinding, 
 
        -- Inline pragma stuff
        idInlinePragma, setInlinePragma, modifyInlinePragma, 
@@ -90,8 +89,7 @@ import Var            ( Id, DictId,
                          globalIdDetails, setGlobalIdDetails
                        )
 import qualified Var   ( mkLocalId, mkGlobalId, mkSpecPragmaId )
-import Type            ( Type, typePrimRep, addFreeTyVars, 
-                          seqType, splitTyConApp_maybe )
+import Type            ( Type, typePrimRep, addFreeTyVars, seqType)
 
 import IdInfo 
 
@@ -100,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 )
@@ -238,6 +237,7 @@ Meanwhile, it is not discarded as dead code.
 recordSelectorFieldLabel :: Id -> FieldLabel
 recordSelectorFieldLabel id = case globalIdDetails id of
                                 RecordSelId lbl -> lbl
+                                other -> panic "recordSelectorFieldLabel"
 
 isRecordSelector id = case globalIdDetails id of
                        RecordSelId lbl -> True
@@ -267,14 +267,6 @@ isDataConWorkId_maybe id = case globalIdDetails id of
                          DataConWorkId con -> Just con
                          other             -> Nothing
 
-isDataConWrapId_maybe id = case globalIdDetails id of
-                                 DataConWrapId con -> Just con
-                                 other             -> Nothing
-
-isDataConWrapId id = case globalIdDetails id of
-                       DataConWrapId con -> True
-                       other             -> False
-
 -- hasNoBinding returns True of an Id which may not have a
 -- binding, even though it is defined in this module.  
 -- Data constructor workers used to be things of this kind, but
@@ -297,7 +289,6 @@ isImplicitId id
         FCallId _       -> True
         PrimOpId _      -> True
        ClassOpId _     -> True
-       GenericOpId _   -> True
         DataConWorkId _ -> True
        DataConWrapId _ -> True
                -- These are are implied by their type or class decl;
@@ -305,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}