X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Ftypecheck%2FTcMType.lhs;h=207411cda5df789c7d6e465fe47cb9743455d284;hb=3a223cd2811d46295048b3a2dab11403ca291b20;hp=3d9f210c8c07cb66c669e52375eed42dd235d838;hpb=221b6b69d68ad9b8de2948b6af40d1c08ffaa0c6;p=ghc-hetmet.git diff --git a/ghc/compiler/typecheck/TcMType.lhs b/ghc/compiler/typecheck/TcMType.lhs index 3d9f210..207411c 100644 --- a/ghc/compiler/typecheck/TcMType.lhs +++ b/ghc/compiler/typecheck/TcMType.lhs @@ -11,7 +11,7 @@ module TcMType ( -------------------------------- -- Creating new mutable type variables - newTyVar, + newTyVar, newSigTyVar, newTyVarTy, -- Kind -> TcM TcType newTyVarTys, -- Int -> Kind -> TcM [TcType] newKindVar, newKindVars, newOpenTypeKind, @@ -112,6 +112,11 @@ newTyVar kind = newUnique `thenM` \ uniq -> newMutTyVar (mkSystemTvNameEncoded uniq FSLIT("t")) kind VanillaTv +newSigTyVar :: Kind -> TcM TcTyVar +newSigTyVar kind + = newUnique `thenM` \ uniq -> + newMutTyVar (mkSystemTvNameEncoded uniq FSLIT("s")) kind SigTv + newTyVarTy :: Kind -> TcM TcType newTyVarTy kind = newTyVar kind `thenM` \ tc_tyvar -> @@ -744,13 +749,25 @@ kindErr kind = ptext SLIT("Expecting an ordinary type, but found a type of %************************************************************************ \begin{code} +-- Enumerate the contexts in which a "source type", , can occur +-- Eq a +-- or ?x::Int +-- or r <: {x::Int} +-- or (N a) where N is a newtype + data SourceTyCtxt = ClassSCCtxt Name -- Superclasses of clas - | SigmaCtxt -- Context of a normal for-all type - | DataTyCtxt Name -- Context of a data decl + -- class => C a where ... + | SigmaCtxt -- Theta part of a normal for-all type + -- f :: => a -> a + | DataTyCtxt Name -- Theta part of a data decl + -- data => T a = MkT a | TypeCtxt -- Source type in an ordinary type + -- f :: N a -> N a | InstThetaCtxt -- Context of an instance decl + -- instance => C [a] where ... | InstHeadCtxt -- Head of an instance decl + -- instance ... => Eq a where ... pprSourceTyCtxt (ClassSCCtxt c) = ptext SLIT("the super-classes of class") <+> quotes (ppr c) pprSourceTyCtxt SigmaCtxt = ptext SLIT("the context of a polymorphic type")