Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document GHC-18365 #535

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Document GHC-18365
lylek committed Aug 19, 2024
commit f4d31f63e6b75a8dca3f8a23e18c1f50e033d306
11 changes: 11 additions & 0 deletions message-index/messages/GHC-18365/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Pattern synonym arity mismatch
summary: The number of arguments in the signature of a pattern synonym is fewer than the number of arguments in its equation.
severity: error
introduced: 9.8.1
---

Just as a function definition cannot specify fewer arguments than its signature,
a pattern synonym's definition cannot specify fewer arguments than its signature.
Specifying more arguments in the signature than in the definition is OK though,
because it would just mean that the last parameter to the synonym is a function.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{-# LANGUAGE PatternSynonyms #-}

module InsufficientArgumentsInSignature where

pattern P :: Int -> Int -> (Int, Int)
pattern P a b = (a, b)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{-# LANGUAGE PatternSynonyms #-}

module InsufficientArgumentsInSignature where

pattern P :: Int -> (Int, Int)
pattern P a b = (a, b)
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Insufficient arguments in type signature
---

## Error Message

```
InsufficientArgumentsInSignature:6:1: error: [GHC-18365]
• Pattern synonym ‘P’ has two arguments
but its type signature has 1 fewer arrows
• In the declaration for pattern synonym ‘P’
|
6 | pattern P a b = (a, b)
| ^^^^^^^^^^^^^^^^^^^^^^
```

## Explanation

In this case, the equation in the definition specified two arguments, but the
signature specified only one.