-
-matchGuard (BindStmt pat rhs locn : stmts) ctx
- = matchGuard stmts ctx `thenDs` \ match_result ->
- putSrcLocDs locn (dsExpr rhs) `thenDs` \ core_rhs ->
- matchSinglePat core_rhs ctx pat match_result
+ -- Reason: dsLet takes the body expression as its argument
+ -- so we can't desugar the bindings without the
+ -- body expression in hand
+
+matchGuards (BindStmt pat bind_rhs _ _ : stmts) ctx rhs rhs_ty
+ = matchGuards stmts ctx rhs rhs_ty `thenDs` \ match_result ->
+ dsLExpr bind_rhs `thenDs` \ core_rhs ->
+ matchSinglePat core_rhs ctx pat rhs_ty match_result