Move isDictTy from TcType to Type
authorsimonpj@microsoft.com <unknown>
Tue, 22 Dec 2009 16:25:50 +0000 (16:25 +0000)
committersimonpj@microsoft.com <unknown>
Tue, 22 Dec 2009 16:25:50 +0000 (16:25 +0000)
compiler/basicTypes/Id.lhs
compiler/typecheck/TcType.lhs
compiler/types/Type.lhs

index e0ccb3e..fbf6b4a 100644 (file)
@@ -101,7 +101,6 @@ import qualified Var
 
 import TyCon
 import Type
-import TcType
 import TysPrim
 import DataCon
 import Demand
index dad167c..728b0be 100644 (file)
@@ -902,11 +902,6 @@ getClassPredTys _ = panic "getClassPredTys"
 mkDictTy :: Class -> [Type] -> Type
 mkDictTy clas tys = mkPredTy (ClassP clas tys)
 
-isDictTy :: Type -> Bool
-isDictTy ty | Just ty' <- tcView ty = isDictTy ty'
-isDictTy (PredTy p) = isClassPred p
-isDictTy _          = False
-
 isDictLikeTy :: Type -> Bool
 -- Note [Dictionary-like types]
 isDictLikeTy ty | Just ty' <- tcView ty = isDictTy ty'
index f894cd3..8a9cf0e 100644 (file)
@@ -6,7 +6,6 @@
 Type - public interface
 
 \begin{code}
-{-# OPTIONS -fno-warn-incomplete-patterns #-}
 -- The above warning supression flag is a temporary kludge.
 -- While working on this module you are encouraged to remove it and fix
 -- any warnings in the module. See
@@ -53,7 +52,7 @@ module Type (
         funTyCon,
 
         -- ** Predicates on types
-        isTyVarTy, isFunTy,
+        isTyVarTy, isFunTy, isDictTy,
 
        -- (Lifting and boxity)
        isUnLiftedType, isUnboxedTupleType, isAlgType, isClosedAlgType,
@@ -820,6 +819,11 @@ pprSourceTyCon tycon
   = ppr $ fam_tc `TyConApp` tys               -- can't be FunTyCon
   | otherwise
   = ppr tycon
+
+isDictTy :: Type -> Bool
+isDictTy ty = case splitTyConApp_maybe ty of
+                Just (tc, _) -> isClassTyCon tc
+               Nothing      -> False
 \end{code}