From f4d31f63e6b75a8dca3f8a23e18c1f50e033d306 Mon Sep 17 00:00:00 2001 From: Lyle Kopnicky Date: Sun, 18 Aug 2024 22:10:48 -0700 Subject: [PATCH] Document GHC-18365 --- message-index/messages/GHC-18365/index.md | 11 ++++++++++ .../after/InsufficientArgumentsInSignature.hs | 6 ++++++ .../InsufficientArgumentsInSignature.hs | 6 ++++++ .../insufficientArgumentsInSignature/index.md | 20 +++++++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 message-index/messages/GHC-18365/index.md create mode 100644 message-index/messages/GHC-18365/insufficientArgumentsInSignature/after/InsufficientArgumentsInSignature.hs create mode 100644 message-index/messages/GHC-18365/insufficientArgumentsInSignature/before/InsufficientArgumentsInSignature.hs create mode 100644 message-index/messages/GHC-18365/insufficientArgumentsInSignature/index.md diff --git a/message-index/messages/GHC-18365/index.md b/message-index/messages/GHC-18365/index.md new file mode 100644 index 0000000..be3099e --- /dev/null +++ b/message-index/messages/GHC-18365/index.md @@ -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. diff --git a/message-index/messages/GHC-18365/insufficientArgumentsInSignature/after/InsufficientArgumentsInSignature.hs b/message-index/messages/GHC-18365/insufficientArgumentsInSignature/after/InsufficientArgumentsInSignature.hs new file mode 100644 index 0000000..85a07bf --- /dev/null +++ b/message-index/messages/GHC-18365/insufficientArgumentsInSignature/after/InsufficientArgumentsInSignature.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE PatternSynonyms #-} + +module InsufficientArgumentsInSignature where + +pattern P :: Int -> Int -> (Int, Int) +pattern P a b = (a, b) diff --git a/message-index/messages/GHC-18365/insufficientArgumentsInSignature/before/InsufficientArgumentsInSignature.hs b/message-index/messages/GHC-18365/insufficientArgumentsInSignature/before/InsufficientArgumentsInSignature.hs new file mode 100644 index 0000000..ae11c19 --- /dev/null +++ b/message-index/messages/GHC-18365/insufficientArgumentsInSignature/before/InsufficientArgumentsInSignature.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE PatternSynonyms #-} + +module InsufficientArgumentsInSignature where + +pattern P :: Int -> (Int, Int) +pattern P a b = (a, b) diff --git a/message-index/messages/GHC-18365/insufficientArgumentsInSignature/index.md b/message-index/messages/GHC-18365/insufficientArgumentsInSignature/index.md new file mode 100644 index 0000000..eb7e6a5 --- /dev/null +++ b/message-index/messages/GHC-18365/insufficientArgumentsInSignature/index.md @@ -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.