Skip to content

Commit dde07d0

Browse files
Merge pull request #516 from haskell/GHC-98980
Document GHC-98980
2 parents 6b80c2f + 290c057 commit dde07d0

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{-# LANGUAGE Arrows #-}
2+
module CommandPattern where
3+
4+
f _ = 5
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{-# LANGUAGE Arrows #-}
2+
module CommandPattern where
3+
4+
f (y -< x) = 5
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: A command in a pattern
3+
---
4+
## Message
5+
```
6+
CommandPattern.hs:4:4: error: [GHC-98980]
7+
Command syntax in pattern: y -< x
8+
|
9+
4 | f (y -< x) = 5
10+
| ^^^^^^
11+
```
12+
13+
## Explanation
14+
15+
In this example, the command `y -< x` is used where a pattern is expected.
16+
To fix the error, replace the command with a pattern.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: Command syntax in pattern
3+
summary: Arrow command syntax was used in a pattern.
4+
severity: error
5+
introduced: 9.6.1
6+
extension: Arrows
7+
---
8+
9+
[Arrows](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/arrows.html) are an abstraction for computations that has special syntactic support in GHC.
10+
When the `Arrows` extension is enabled, some expressions that would normally be interpreted as containing the infix operators `-<` and `-<<` are instead interpreted as a new syntactic category of _commands_.
11+
These commands do not make sense as patterns, and using them in a pattern context is an error.

0 commit comments

Comments
 (0)