From af7c22d99d3067c4769fc6f2ef21aecbb1268f50 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Tue, 22 Dec 2009 16:25:50 +0000 Subject: [PATCH] Move isDictTy from TcType to Type --- compiler/basicTypes/Id.lhs | 1 - compiler/typecheck/TcType.lhs | 5 ----- compiler/types/Type.lhs | 8 ++++++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/compiler/basicTypes/Id.lhs b/compiler/basicTypes/Id.lhs index e0ccb3e..fbf6b4a 100644 --- a/compiler/basicTypes/Id.lhs +++ b/compiler/basicTypes/Id.lhs @@ -101,7 +101,6 @@ import qualified Var import TyCon import Type -import TcType import TysPrim import DataCon import Demand diff --git a/compiler/typecheck/TcType.lhs b/compiler/typecheck/TcType.lhs index dad167c..728b0be 100644 --- a/compiler/typecheck/TcType.lhs +++ b/compiler/typecheck/TcType.lhs @@ -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' diff --git a/compiler/types/Type.lhs b/compiler/types/Type.lhs index f894cd3..8a9cf0e 100644 --- a/compiler/types/Type.lhs +++ b/compiler/types/Type.lhs @@ -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} -- 1.7.10.4