diff --git a/message-index/messages/GHC-06202/example1/after/Example1.hs b/message-index/messages/GHC-06202/example1/after/Example1.hs new file mode 100644 index 00000000..06a1573b --- /dev/null +++ b/message-index/messages/GHC-06202/example1/after/Example1.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE Haskell2010, InstanceSigs #-} +module Example1 where + +data A = A | B +instance Eq A where + (==) :: A -> A -> Bool + A == A = True + B == B = True + _ == _ = False diff --git a/message-index/messages/GHC-06202/example1/before/Example1.hs b/message-index/messages/GHC-06202/example1/before/Example1.hs new file mode 100644 index 00000000..ad2bbfaa --- /dev/null +++ b/message-index/messages/GHC-06202/example1/before/Example1.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE Haskell2010 #-} +module Example1 where + +data A = A | B +instance Eq A where + (==) :: A -> A -> Bool + A == A = True + B == B = True + _ == _ = False diff --git a/message-index/messages/GHC-06202/example1/index.md b/message-index/messages/GHC-06202/example1/index.md new file mode 100644 index 00000000..0c8f9247 --- /dev/null +++ b/message-index/messages/GHC-06202/example1/index.md @@ -0,0 +1,17 @@ +--- +title: Illegal type signature in instance declaration +--- + +## Error message + +Type signatures are only allowed to be in instance declarations when the `InstanceSigs` language extension is enabled. + +``` +Example1.hs:6:13: error: [GHC-06202] + • Illegal type signature in instance declaration: + (==) :: A -> A -> Bool + • In the instance declaration for ‘Eq A’ + Suggested fix: Perhaps you intended to use InstanceSigs + | +6 | (==) :: A -> A -> Bool +``` diff --git a/message-index/messages/GHC-06202/index.md b/message-index/messages/GHC-06202/index.md new file mode 100644 index 00000000..734bcd29 --- /dev/null +++ b/message-index/messages/GHC-06202/index.md @@ -0,0 +1,8 @@ +--- +title: Illegal type signature in instance declaration +summary: Method in class instance has type signature, but extension InstanceSigs is not enabled +severity: error +introduced: 9.6.1 +--- + +This error is emitted when class instance has type signature, but extension [InstanceSigs](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/instances.html#instance-signatures-type-signatures-in-instance-declarations) is not enabled. Note that `InstanceSigs` is part of `GHC2021` and `GHC2024` [editions](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/control.html), so you won't encounter this error in new code unless you explicitely opt-out.