- tup_expr | one_var = ret1
- | otherwise = noLoc $ ExplicitTuple rets Boxed
- var_tys = map idType vars
- tup_ty = mkCoreTupTy var_tys -- Deals with singleton case
- tup_pat | one_var = nlVarPat var1
- | otherwise = noLoc $ LazyPat (noLoc $ TuplePat (map nlVarPat vars) Boxed)
-
- body = noLoc $ HsDo DoExpr (stmts ++ [return_stmt])
- [(n, HsVar id) | (n,id) <- ds_meths] -- A bit of a hack
- body_ty
+ -- The rec_tup_pat must bind the rec_vars only; remember that the
+ -- trimmed_laters may share the same Names
+ -- Meanwhile, the later_pats must bind the later_vars
+ rec_tup_pats = map mk_wild_pat trimmed_laters ++ map nlVarPat rec_vars
+ later_pats = map nlVarPat trimmed_laters ++ map mk_later_pat rec_vars
+ rets = map nlHsVar trimmed_laters ++ rec_rets
+
+ mfix_pat = noLoc $ LazyPat $ mk_tup_pat rec_tup_pats
+ body = noLoc $ HsDo DoExpr (stmts ++ [return_stmt])
+ [(n, HsVar id) | (n,id) <- ds_meths] -- A bit of a hack
+ body_ty