Skip to content

Commit 20850e8

Browse files
Merge pull request #364 from mrgutkun/main
Document another case of GHC-53786
2 parents 48e7e15 + 6bb544d commit 20850e8

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module CaseExprInDoBlock where
2+
3+
x :: [a]
4+
x = do
5+
case () of
6+
() -> do
7+
a <- []
8+
pure a
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module CaseExprInDoBlock where
2+
3+
x :: [a]
4+
x = do
5+
case () of
6+
() ->
7+
a <- []
8+
pure a
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: Case expression in do-block
3+
---
4+
5+
The expression in one branch of the case expression is a `do`-block that's missing a `do`. This triggers a corner case in the grammar of Haskell, and the `case`-expression is interpreted as the pattern part of a bind statement in the top-level `do`-block.
6+
7+
More details are available at https://gitlab.haskell.org/ghc/ghc/-/issues/984
8+
9+
## Error Message
10+
11+
```
12+
CaseExprInDoBlock.hs:5:3: error: [GHC-53786]
13+
(case ... of ...)-syntax in pattern
14+
|
15+
5 | case () of
16+
| ^^^^^^^^^^...
17+
18+
```

0 commit comments

Comments
 (0)