+zonkMonoBinds (FunMonoBind var inf ms locn)
+ = zonkIdBndr var `thenNF_Tc` \ new_var ->
+ mapNF_Tc zonkMatch ms `thenNF_Tc` \ new_ms ->
+ returnNF_Tc (FunMonoBind new_var inf new_ms locn, unitBag new_var)
+
+
+zonkMonoBinds (AbsBinds tyvars dicts exports inlines val_bind)
+ = mapNF_Tc zonkTcTyVarToTyVar tyvars `thenNF_Tc` \ new_tyvars ->
+ -- No need to extend tyvar env: the effects are
+ -- propagated through binding the tyvars themselves
+
+ mapNF_Tc zonkIdBndr dicts `thenNF_Tc` \ new_dicts ->
+ tcExtendGlobalValEnv new_dicts $
+
+ fixNF_Tc (\ ~(_, _, val_bind_ids) ->
+ tcExtendGlobalValEnv (bagToList val_bind_ids) $
+ zonkMonoBinds val_bind `thenNF_Tc` \ (new_val_bind, val_bind_ids) ->
+ mapNF_Tc zonkExport exports `thenNF_Tc` \ new_exports ->
+ returnNF_Tc (new_val_bind, new_exports, val_bind_ids)
+ ) `thenNF_Tc ` \ (new_val_bind, new_exports, _) ->
+ let
+ new_globals = listToBag [global | (_, global, local) <- new_exports]
+ in
+ returnNF_Tc (AbsBinds new_tyvars new_dicts new_exports inlines new_val_bind,
+ new_globals)
+ where
+ zonkExport (tyvars, global, local)
+ = zonkTcSigTyVars tyvars `thenNF_Tc` \ new_tyvars ->
+ -- This isn't the binding occurrence of these tyvars
+ -- but they should *be* tyvars. Hence zonkTcSigTyVars.
+ zonkIdBndr global `thenNF_Tc` \ new_global ->
+ zonkIdOcc local `thenNF_Tc` \ new_local ->
+ returnNF_Tc (new_tyvars, new_global, new_local)