diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2016-05-27 15:26:46 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2016-06-15 14:41:49 +0100 |
commit | 77bb09270c70455bbd547470c4e995707d19f37d (patch) | |
tree | 3dbd57122d9931d2766fa32df0a4a29731f02d2a /compiler/iface/MkIface.hs | |
parent | e33ca0e54f3c20a8b233a3f7b38e4968a4955300 (diff) | |
download | haskell-77bb09270c70455bbd547470c4e995707d19f37d.tar.gz |
Re-add FunTy (big patch)
With TypeInType Richard combined ForAllTy and FunTy, but that was often
awkward, and yielded little benefit becuase in practice the two were
always treated separately. This patch re-introduces FunTy. Specfically
* New type
data TyVarBinder = TvBndr TyVar VisibilityFlag
This /always/ has a TyVar it. In many places that's just what
what we want, so there are /lots/ of TyBinder -> TyVarBinder changes
* TyBinder still exists:
data TyBinder = Named TyVarBinder | Anon Type
* data Type = ForAllTy TyVarBinder Type
| FunTy Type Type
| ....
There are a LOT of knock-on changes, but they are all routine.
The Haddock submodule needs to be updated too
Diffstat (limited to 'compiler/iface/MkIface.hs')
-rw-r--r-- | compiler/iface/MkIface.hs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs index fcf63af369..aedec424ae 100644 --- a/compiler/iface/MkIface.hs +++ b/compiler/iface/MkIface.hs @@ -1321,10 +1321,10 @@ patSynToIfaceDecl ps } where (_univ_tvs, req_theta, _ex_tvs, prov_theta, args, rhs_ty) = patSynSig ps - univ_bndrs = patSynUnivTyBinders ps - ex_bndrs = patSynExTyBinders ps - (env1, univ_bndrs') = tidyTyBinders emptyTidyEnv univ_bndrs - (env2, ex_bndrs') = tidyTyBinders env1 ex_bndrs + univ_bndrs = patSynUnivTyVarBinders ps + ex_bndrs = patSynExTyVarBinders ps + (env1, univ_bndrs') = tidyTyVarBinders emptyTidyEnv univ_bndrs + (env2, ex_bndrs') = tidyTyVarBinders env1 ex_bndrs to_if_pr (id, needs_dummy) = (idName id, needs_dummy) -------------------------- @@ -1415,12 +1415,15 @@ tyConToIfaceDecl env tycon ifParent = parent }) | otherwise -- FunTyCon, PrimTyCon, promoted TyCon/DataCon - -- For pretty printing purposes only. + -- We only convert these TyCons to IfaceTyCons when we are + -- just about to pretty-print them, not because we are going + -- to put them into interface files = ( env , IfaceData { ifName = getOccName tycon, ifBinders = if_degenerate_binders, ifResKind = if_degenerate_res_kind, - -- These don't have `tyConTyVars`, hence "degenerate" + -- FunTyCon, PrimTyCon etc don't have + -- `tyConTyVars`, hence "degenerate" ifCType = Nothing, ifRoles = tyConRoles tycon, ifCtxt = [], @@ -1438,7 +1441,7 @@ tyConToIfaceDecl env tycon if_syn_type ty = tidyToIfaceType tc_env1 ty if_res_var = getOccFS `fmap` tyConFamilyResVar_maybe tycon - -- use these when you don't have tyConTyVars + -- Use these when you don't have tyConTyVars (degenerate_binders, degenerate_res_kind) = splitPiTys (tidyType env (tyConKind tycon)) if_degenerate_binders = toDegenerateBinders degenerate_binders @@ -1492,7 +1495,7 @@ tyConToIfaceDecl env tycon where (univ_tvs, _ex_tvs, eq_spec, theta, arg_tys, _) = dataConFullSig data_con - ex_bndrs = dataConExTyBinders data_con + ex_bndrs = dataConExTyVarBinders data_con -- Tidy the univ_tvs of the data constructor to be identical -- to the tyConTyVars of the type constructor. This means @@ -1504,8 +1507,8 @@ tyConToIfaceDecl env tycon con_env1 = (fst tc_env1, mkVarEnv (zipEqual "ifaceConDecl" univ_tvs tc_tyvars)) -- A bit grimy, perhaps, but it's simple! - (con_env2, ex_bndrs') = tidyTyBinders con_env1 ex_bndrs - to_eq_spec (tv,ty) = (toIfaceTyVar (tidyTyVar con_env2 tv), tidyToIfaceType con_env2 ty) + (con_env2, ex_bndrs') = tidyTyVarBinders con_env1 ex_bndrs + to_eq_spec (tv,ty) = (toIfaceTyVar (tidyTyVar con_env2 tv), tidyToIfaceType con_env2 ty) ifaceOverloaded flds = case dFsEnvElts flds of fl:_ -> flIsOverloaded fl |