X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcType.lhs;h=04f50d3b898ebcde812d50aca6db0ae9612c4bab;hb=40f5a0759bd07308009c3ae8956dfa061c684ebd;hp=ed29d65b95113d3c6cc2a1ac581b3f33aa3628bd;hpb=b8c98e4e8457c58ac0798b78e0431434262c3f54;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcType.lhs b/compiler/typecheck/TcType.lhs index ed29d65..04f50d3 100644 --- a/compiler/typecheck/TcType.lhs +++ b/compiler/typecheck/TcType.lhs @@ -88,7 +88,7 @@ module TcType ( -------------------------------- -- Rexported from Type Kind, -- Stuff to do with kinds is insensitive to pre/post Tc - unliftedTypeKind, liftedTypeKind, unboxedTypeKind, + unliftedTypeKind, liftedTypeKind, unboxedTypeKind, argTypeKind, openTypeKind, mkArrowKind, mkArrowKinds, isLiftedTypeKind, isUnliftedTypeKind, isOpenTypeKind, isArgTypeKind, isSubKind, defaultKind, @@ -132,7 +132,7 @@ import TypeRep ( Type(..), funTyCon ) -- friend import Type ( -- Re-exports tyVarsOfType, tyVarsOfTypes, tyVarsOfPred, tyVarsOfTheta, Kind, PredType(..), - ThetaType, unliftedTypeKind, unboxedTypeKind, + ThetaType, unliftedTypeKind, unboxedTypeKind, argTypeKind, liftedTypeKind, openTypeKind, mkArrowKind, isLiftedTypeKind, isUnliftedTypeKind, mkArrowKinds, mkForAllTy, mkForAllTys, @@ -700,9 +700,9 @@ tcSplitFunTysN ty n_args | otherwise = ([], ty) -tcFunArgTy ty = case tcSplitFunTy_maybe ty of { Just (arg,res) -> arg } -tcFunResultTy ty = case tcSplitFunTy_maybe ty of { Just (arg,res) -> res } - +tcSplitFunTy ty = expectJust "tcSplitFunTy" (tcSplitFunTy_maybe ty) +tcFunArgTy ty = fst (tcSplitFunTy ty) +tcFunResultTy ty = snd (tcSplitFunTy ty) ----------------------- tcSplitAppTy_maybe :: Type -> Maybe (Type, Type) @@ -750,6 +750,7 @@ tcSplitDFunHead :: Type -> (Class, [Type]) tcSplitDFunHead tau = case tcSplitPredTy_maybe tau of Just (ClassP clas tys) -> (clas, tys) + other -> panic "tcSplitDFunHead" tcValidInstHeadTy :: Type -> Bool -- Used in Haskell-98 mode, for the argument types of an instance head @@ -816,6 +817,7 @@ getClassPredTys_maybe _ = Nothing getClassPredTys :: PredType -> (Class, [Type]) getClassPredTys (ClassP clas tys) = (clas, tys) +getClassPredTys other = panic "getClassPredTys" mkDictTy :: Class -> [Type] -> Type mkDictTy clas tys = mkPredTy (ClassP clas tys) @@ -869,6 +871,7 @@ dataConsStupidTheta (con1:cons) | con <- cons , let Just subst = tcMatchTys tvs1 res_tys1 (dataConResTys con) , pred <- dataConStupidTheta con ] +dataConsStupidTheta [] = panic "dataConsStupidTheta" \end{code} @@ -1117,12 +1120,14 @@ toDNType :: Type -> DNType toDNType ty | isStringTy ty = DNString | isFFIDotnetObjTy ty = DNObject - | Just (tc,argTys) <- tcSplitTyConApp_maybe ty = - case lookup (getUnique tc) dn_assoc of + | Just (tc,argTys) <- tcSplitTyConApp_maybe ty + = case lookup (getUnique tc) dn_assoc of Just x -> x Nothing | tc `hasKey` ioTyConKey -> toDNType (head argTys) - | otherwise -> pprPanic ("toDNType: unsupported .NET type") (pprType ty <+> parens (hcat (map pprType argTys)) <+> ppr tc) + | otherwise -> pprPanic ("toDNType: unsupported .NET type") + (pprType ty <+> parens (hcat (map pprType argTys)) <+> ppr tc) + | otherwise = panic "toDNType" -- Is this right? where dn_assoc :: [ (Unique, DNType) ] dn_assoc = [ (unitTyConKey, DNUnit)