-zonkQuals quals
- = mapNF_Tc zonk_qual quals
- where
- zonk_qual (GeneratorQual pat expr)
- = zonkPat pat `thenNF_Tc` \ new_pat ->
- zonkExpr expr `thenNF_Tc` \ new_expr ->
- returnNF_Tc (GeneratorQual new_pat new_expr)
+zonkStmts [] = returnNF_Tc []
+
+zonkStmts (ParStmtOut bndrstmtss : stmts)
+ = mapNF_Tc (mapNF_Tc zonkId) bndrss `thenNF_Tc` \ new_bndrss ->
+ let new_binders = concat new_bndrss in
+ mapNF_Tc zonkStmts stmtss `thenNF_Tc` \ new_stmtss ->
+ tcExtendGlobalValEnv new_binders $
+ zonkStmts stmts `thenNF_Tc` \ new_stmts ->
+ returnNF_Tc (ParStmtOut (zip new_bndrss new_stmtss) : new_stmts)
+ where (bndrss, stmtss) = unzip bndrstmtss
+
+zonkStmts [ReturnStmt expr]
+ = zonkExpr expr `thenNF_Tc` \ new_expr ->
+ returnNF_Tc [ReturnStmt new_expr]
+
+zonkStmts (ExprStmt expr locn : stmts)
+ = zonkExpr expr `thenNF_Tc` \ new_expr ->
+ zonkStmts stmts `thenNF_Tc` \ new_stmts ->
+ returnNF_Tc (ExprStmt new_expr locn : new_stmts)
+
+zonkStmts (GuardStmt expr locn : stmts)
+ = zonkExpr expr `thenNF_Tc` \ new_expr ->
+ zonkStmts stmts `thenNF_Tc` \ new_stmts ->
+ returnNF_Tc (GuardStmt new_expr locn : new_stmts)
+
+zonkStmts (LetStmt binds : stmts)
+ = zonkBinds binds `thenNF_Tc` \ (new_binds, new_env) ->
+ tcSetEnv new_env $
+ zonkStmts stmts `thenNF_Tc` \ new_stmts ->
+ returnNF_Tc (LetStmt new_binds : new_stmts)
+
+zonkStmts (BindStmt pat expr locn : stmts)
+ = zonkExpr expr `thenNF_Tc` \ new_expr ->
+ zonkPat pat `thenNF_Tc` \ (new_pat, new_ids) ->
+ tcExtendGlobalValEnv (bagToList new_ids) $
+ zonkStmts stmts `thenNF_Tc` \ new_stmts ->
+ returnNF_Tc (BindStmt new_pat new_expr locn : new_stmts)