diff --git a/message-index/messages/GHC-18365/index.md b/message-index/messages/GHC-18365/index.md new file mode 100644 index 00000000..be3099e9 --- /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 00000000..85a07bfe --- /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 00000000..ae11c194 --- /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 00000000..eb7e6a5e --- /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.