X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FhsSyn%2FHsTypes.lhs;h=49040bfc0e4a765a283d34ef7bacd52e883e03ee;hb=adc02cf2e77529989959e40dd7d3afb84f7780cf;hp=f5156aeebae1e3c4d4876ddef00e74f1a4f8b15f;hpb=a5ded1f8e90fd3dfc0cb05767923bcb0dd7392af;p=ghc-hetmet.git diff --git a/ghc/compiler/hsSyn/HsTypes.lhs b/ghc/compiler/hsSyn/HsTypes.lhs index f5156ae..49040bf 100644 --- a/ghc/compiler/hsSyn/HsTypes.lhs +++ b/ghc/compiler/hsSyn/HsTypes.lhs @@ -11,7 +11,10 @@ module HsTypes ( , hsUsOnce, hsUsMany , mkHsForAllTy, mkHsDictTy, mkHsIParamTy - , hsTyVarName, hsTyVarNames, replaceTyVarName + , hsTyVarName, hsTyVarNames, replaceTyVarName, + + -- Type place holder + PostTcType, placeHolderType, -- Printing , pprParendHsType, pprHsForAll, pprHsContext, pprHsTyVarBndr @@ -36,17 +39,41 @@ import RdrName ( RdrName, mkUnqual ) import Name ( Name, getName ) import OccName ( NameSpace, tvName ) import Var ( TyVar, tyVarKind ) -import Subst ( mkTyVarSubst, substTy ) +import Subst ( substTyWith ) import PprType ( {- instance Outputable Kind -}, pprParendKind ) import BasicTypes ( Boxity(..), Arity, tupleParens ) import PrelNames ( mkTupConRdrName, listTyConKey, usOnceTyConKey, usManyTyConKey, hasKey, usOnceTyConName, usManyTyConName ) import FiniteMap +import Util ( eqListBy ) import Outputable +\end{code} + + +%************************************************************************ +%* * +\subsection{Annotating the syntax} +%* * +%************************************************************************ + +\begin{code} +type PostTcType = Type -- Used for slots in the abstract syntax + -- where we want to keep slot for a type + -- to be added by the type checker...but + -- before typechecking it's just bogus +placeHolderType :: PostTcType -- Used before typechecking +placeHolderType = panic "Evaluated the place holder for a PostTcType" \end{code} + +%************************************************************************ +%* * +\subsection{Data types} +%* * +%************************************************************************ + This is the syntax for types as seen in type signatures. \begin{code} @@ -75,6 +102,7 @@ data HsType name -- Generics | HsOpTy (HsType name) name (HsType name) | HsNumTy Integer + -- these next two are only used in interfaces | HsPredTy (HsPred name) @@ -285,7 +313,7 @@ toHsType (NoteTy (SynNote ty@(TyConApp tycon tyargs)) real_ty) where syn_matches = ty_from_syn `tcEqType` real_ty (tyvars,syn_ty) = getSynTyConDefn tycon - ty_from_syn = substTy (mkTyVarSubst tyvars tyargs) syn_ty + ty_from_syn = substTyWith tyvars tyargs syn_ty -- We only use the type synonym in the file if this doesn't cause -- us to lose important information. This matters for usage @@ -443,10 +471,4 @@ eq_hsPred env (HsClassP c1 tys1) (HsClassP c2 tys2) eq_hsPred env (HsIParam n1 ty1) (HsIParam n2 ty2) = n1 == n2 && eq_hsType env ty1 ty2 eq_hsPred env _ _ = False - -------------------- -eqListBy :: (a->a->Bool) -> [a] -> [a] -> Bool -eqListBy eq [] [] = True -eqListBy eq (x:xs) (y:ys) = eq x y && eqListBy eq xs ys -eqListBy eq xs ys = False \end{code}