[project @ 2000-03-01 18:10:43 by lewie]
authorlewie <unknown>
Wed, 1 Mar 2000 18:10:44 +0000 (18:10 +0000)
committerlewie <unknown>
Wed, 1 Mar 2000 18:10:44 +0000 (18:10 +0000)
Filled in some missing support for importing defs w/ implicit params.
Fixed bug in improvement w/ implicit params.

ghc/compiler/hsSyn/HsTypes.lhs
ghc/compiler/rename/RnHsSyn.lhs
ghc/compiler/rename/RnSource.lhs
ghc/compiler/typecheck/TcImprove.lhs
ghc/compiler/typecheck/TcMonoType.lhs

index c9637b4..2536e8d 100644 (file)
@@ -186,6 +186,9 @@ ppr_mono_ty ctxt_prec (MonoTyApp fun_ty arg_ty)
   = maybeParen (ctxt_prec >= pREC_CON)
               (hsep [ppr_mono_ty pREC_FUN fun_ty, ppr_mono_ty pREC_CON arg_ty])
 
+ppr_mono_ty ctxt_prec (MonoIParamTy n ty)
+  = hsep [{- char '?' <> -} ppr n, text "::", ppr_mono_ty pREC_TOP ty]
+
 ppr_mono_ty ctxt_prec (MonoDictTy clas tys)
   = ppr clas <+> hsep (map (ppr_mono_ty pREC_CON) tys)
 
index d30ef40..58d7128 100644 (file)
@@ -81,6 +81,7 @@ extractHsTyNames ty
     get (MonoTupleTy tys boxed)  = unitNameSet (tupleTyCon_name boxed (length tys)) 
                                   `unionNameSets` extractHsTyNames_s tys
     get (MonoFunTy ty1 ty2)      = get ty1 `unionNameSets` get ty2
+    get (MonoIParamTy n ty)     = get ty
     get (MonoDictTy cls tys)     = unitNameSet cls `unionNameSets` extractHsTyNames_s tys
     get (MonoUsgForAllTy uv ty)  = get ty
     get (MonoUsgTy u ty)         = get ty
index 26e6dee..0ef3d39 100644 (file)
@@ -646,6 +646,11 @@ rnHsType doc (MonoTyApp ty1 ty2)
     rnHsType doc ty2           `thenRn` \ (ty2', fvs2) ->
     returnRn (MonoTyApp ty1' ty2', fvs1 `plusFV` fvs2)
 
+rnHsType doc (MonoIParamTy n ty)
+  = getIPName n                        `thenRn` \ name ->
+    rnHsType doc ty            `thenRn` \ (ty', fvs) ->
+    returnRn (MonoIParamTy name ty', fvs)
+
 rnHsType doc (MonoDictTy clas tys)
   = lookupOccRn clas           `thenRn` \ clas' ->
     rnHsTypes doc tys          `thenRn` \ (tys', fvs) ->
index dfe35dd..1451d44 100644 (file)
@@ -25,7 +25,7 @@ import List           ( elemIndex, nub )
 
 \begin{code}
 tcImprove lie =
-    if null cfdss then
+    if null nfdss then
        returnTc ()
     else
        -- zonkCfdss cfdss `thenTc` \ cfdss' ->
index 29ae73f..1d6087c 100644 (file)
@@ -33,7 +33,8 @@ import TcUnify                ( unifyKind, unifyKinds, unifyTypeKind )
 import Type            ( Type, PredType(..), ThetaType, UsageAnn(..),
                          mkTyVarTy, mkTyVarTys, mkFunTy, mkSynTy, mkUsgTy,
                           mkUsForAllTy, zipFunTys,
-                         mkSigmaTy, mkDictTy, mkTyConApp, mkAppTys, splitForAllTys, splitRhoTy,
+                         mkSigmaTy, mkDictTy, mkPredTy, mkTyConApp,
+                         mkAppTys, splitForAllTys, splitRhoTy,
                          boxedTypeKind, unboxedTypeKind, tyVarsOfType,
                          mkArrowKinds, getTyVar_maybe, getTyVar,
                          tidyOpenType, tidyOpenTypes, tidyTyVar,
@@ -140,7 +141,7 @@ tc_type ty
 tc_type_kind :: RenamedHsType -> TcM s (TcKind, Type)
 tc_type_kind ty@(MonoTyVar name)
   = tc_app ty []
-    
+
 tc_type_kind (MonoListTy ty)
   = tc_boxed_type ty           `thenTc` \ tau_ty ->
     returnTc (boxedTypeKind, mkListTy tau_ty)
@@ -161,6 +162,10 @@ tc_type_kind (MonoFunTy ty1 ty2)
 tc_type_kind (MonoTyApp ty1 ty2)
   = tc_app ty1 [ty2]
 
+tc_type_kind (MonoIParamTy n ty)
+  = tc_type ty `thenTc` \ tau ->
+    returnTc (boxedTypeKind, mkPredTy (IParam n tau))
+
 tc_type_kind (MonoDictTy class_name tys)
   = tcClassAssertion (HsPClass class_name tys) `thenTc` \ (Class clas arg_tys) ->
     returnTc (boxedTypeKind, mkDictTy clas arg_tys)