- returnRn (MonoTyVar tyvar')
-
-rnHsType (MonoFunTy ty1 ty2)
- = andRn MonoFunTy (rnHsType ty1) (rnHsType ty2)
-
-rnHsType (MonoListTy _ ty)
- = lookupImplicitOccRn listType_RDR `thenRn` \ tycon_name ->
- rnHsType ty `thenRn` \ ty' ->
- returnRn (MonoListTy tycon_name ty')
-
-rnHsType (MonoTupleTy _ tys)
- = lookupImplicitOccRn (tupleType_RDR (length tys)) `thenRn` \ tycon_name ->
- mapRn rnHsType tys `thenRn` \ tys' ->
- returnRn (MonoTupleTy tycon_name tys')
-
-rnHsType (MonoTyApp ty1 ty2)
- = rnHsType ty1 `thenRn` \ ty1' ->
- rnHsType ty2 `thenRn` \ ty2' ->
- returnRn (MonoTyApp ty1' ty2')
-
-rnHsType (MonoDictTy clas ty)
- = lookupOccRn clas `thenRn` \ clas' ->
- rnHsType ty `thenRn` \ ty' ->
- returnRn (MonoDictTy clas' ty')
-
-rn_poly_help :: [HsTyVar RdrName] -- Universally quantified tyvars
- -> RdrNameContext
- -> RdrNameHsType
- -> RnMS s RenamedHsType
-rn_poly_help tyvars ctxt ty
- = bindTyVarsRn sig_doc tyvars $ \ new_tyvars ->
- rnContext ctxt `thenRn` \ new_ctxt ->
- rnHsType ty `thenRn` \ new_ty ->
- returnRn (HsForAllTy new_tyvars new_ctxt new_ty)
+ returnRn (HsTyVar tyvar', unitFV tyvar')
+
+rnHsType doc (HsOpTy ty1 opname ty2)
+ = lookupOccRn opname `thenRn` \ name' ->
+ rnHsType doc ty1 `thenRn` \ (ty1', fvs1) ->
+ rnHsType doc ty2 `thenRn` \ (ty2',fvs2) ->
+ returnRn (HsOpTy ty1' name' ty2', fvs1 `plusFV` fvs2 `addOneFV` name')
+
+rnHsType doc (HsNumTy i)
+ | i == 1 = returnRn (HsNumTy i, emptyFVs)
+ | otherwise = failWithRn (HsNumTy i, emptyFVs)
+ (ptext SLIT("Only unit numeric type pattern is valid"))
+
+rnHsType doc (HsFunTy ty1 ty2)
+ = rnHsType doc ty1 `thenRn` \ (ty1', fvs1) ->
+ -- Might find a for-all as the arg of a function type
+ rnHsType doc ty2 `thenRn` \ (ty2', fvs2) ->
+ -- Or as the result. This happens when reading Prelude.hi
+ -- when we find return :: forall m. Monad m -> forall a. a -> m a
+ returnRn (HsFunTy ty1' ty2', fvs1 `plusFV` fvs2)
+
+rnHsType doc (HsListTy ty)
+ = rnHsType doc ty `thenRn` \ (ty', fvs) ->
+ returnRn (HsListTy ty', fvs `addOneFV` listTyCon_name)
+
+-- Unboxed tuples are allowed to have poly-typed arguments. These
+-- sometimes crop up as a result of CPR worker-wrappering dictionaries.
+rnHsType doc (HsTupleTy (HsTupCon _ boxity) tys)
+ -- Don't do lookupOccRn, because this is built-in syntax
+ -- so it doesn't need to be in scope
+ = mapFvRn (rnHsType doc) tys `thenRn` \ (tys', fvs) ->
+ returnRn (HsTupleTy (HsTupCon n' boxity) tys', fvs `addOneFV` n')