summaryrefslogtreecommitdiff
path: root/testsuite/tests/ado/ado001.stdout
diff options
context:
space:
mode:
authorZiyang Liu <unsafeFixIO@gmail.com>2022-04-23 21:31:54 -0700
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-05-06 19:22:22 -0400
commite2ae9518c0373db7a99058a09388043a66af80ad (patch)
treea14fbe0c8d4703b022b9193275237ea09a81173b /testsuite/tests/ado/ado001.stdout
parent73b22ff196160036ac10b762bf3a363fa8a451ad (diff)
downloadhaskell-e2ae9518c0373db7a99058a09388043a66af80ad.tar.gz
Allow `let` just before pure/return in ApplicativeDo
The following is currently rejected: ```haskell -- F is an Applicative but not a Monad x :: F (Int, Int) x = do a <- pure 0 let b = 1 pure (a, b) ``` This has bitten me multiple times. This MR contains a simple fix: only allow a "let only" segment to be merged with the next (and not the previous) segment. As a result, when the last one or more statements before pure/return are `LetStmt`s, there will be one more segment containing only those `LetStmt`s. Note that if the `let` statement mentions a name bound previously, then the program is still rejected, for example ```haskell x = do a <- pure 0 let b = a + 1 pure (a, b) ``` or the example in #18559. To support this would require a more complex approach, but this is IME much less common than the previous case.
Diffstat (limited to 'testsuite/tests/ado/ado001.stdout')
-rw-r--r--testsuite/tests/ado/ado001.stdout4
1 files changed, 2 insertions, 2 deletions
diff --git a/testsuite/tests/ado/ado001.stdout b/testsuite/tests/ado/ado001.stdout
index 365860f55e..f4f576e084 100644
--- a/testsuite/tests/ado/ado001.stdout
+++ b/testsuite/tests/ado/ado001.stdout
@@ -6,7 +6,7 @@ a; g
a; (b | (c; (d; (e | (f; g)))))
(a | b); (c | d)
a; ((b | c) | d)
-((a | (b; c)) | d) | e
+(((a | (b; c)) | d) | e) | pure
((a | b); (c | d)) | e
-a | b
+(a | b) | pure
a | (b; c)