diff --git a/message-index/messages/GHC-86639/example1/after/AddAFunctor.hs b/message-index/messages/GHC-86639/example1/after/AddAFunctor.hs new file mode 100644 index 00000000..cb650db6 --- /dev/null +++ b/message-index/messages/GHC-86639/example1/after/AddAFunctor.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE DeriveFunctor #-} +module AddAFunctor where + +data MyFunctor a = MyFunctor a a + deriving Functor diff --git a/message-index/messages/GHC-86639/example1/before/AddAFunctor.hs b/message-index/messages/GHC-86639/example1/before/AddAFunctor.hs new file mode 100644 index 00000000..6472081d --- /dev/null +++ b/message-index/messages/GHC-86639/example1/before/AddAFunctor.hs @@ -0,0 +1,4 @@ +module AddAFunctor where + +data MyFunctor a = MyFunctor a a + deriving Functor diff --git a/message-index/messages/GHC-86639/example1/index.md b/message-index/messages/GHC-86639/example1/index.md new file mode 100644 index 00000000..57ba8bd9 --- /dev/null +++ b/message-index/messages/GHC-86639/example1/index.md @@ -0,0 +1,10 @@ +--- +title: Require the DerivingFunctor language extension for Functor instances +--- + +When deriving a `Functor` instance for a datatype in Haskell2010, the +`DerivingFunctor` language extension must be turned on. This can be done with a +pragma at the top of the file, or in build settings. + +The `DerivingFunctor` extension is turned on automatically from Haskell2021 +onwards. diff --git a/message-index/messages/GHC-86639/index.md b/message-index/messages/GHC-86639/index.md new file mode 100644 index 00000000..ee02c299 --- /dev/null +++ b/message-index/messages/GHC-86639/index.md @@ -0,0 +1,20 @@ +--- +title: Cannot derive an instance without a corresponding language extension +summary: A language extension must be turned on for a typeclass to be derived. +severity: error +introduced: 9.6.1 +--- + +Some typeclasses can be derived automatically in the `deriving` declaration, but +require a certain language extension to be turned on. + +For example, to derive `Functor` on a datatype, the `DeriveFunctor` language +extension must be turned on. + +There are many available language extensions for deriving instances, the +appropriate extension depends on the typeclass -- for example, deriving `Functor` +requires the `DeriveFunctor` language extension, deriving `Generic` requires +`DeriveGeneric`, and deriving `Lift` requires `DeriveLift`, among others. + +There is more info on deriving instances for extra typeclasses in the [GHC user +manual](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/deriving_extra.html). diff --git a/message-index/messages/GHC-91999/example1/after/BootModuleDataTypeNotInOrdinaryModule.hs b/message-index/messages/GHC-91999/example1/after/BootModuleDataTypeNotInOrdinaryModule.hs new file mode 100644 index 00000000..3d5071b7 --- /dev/null +++ b/message-index/messages/GHC-91999/example1/after/BootModuleDataTypeNotInOrdinaryModule.hs @@ -0,0 +1,3 @@ +module BootModuleDataTypeNotInOrdinaryModule where + +data BootModuleOnlyDataType = BootModuleOnlyDataType String diff --git a/message-index/messages/GHC-91999/example1/after/BootModuleDataTypeNotInOrdinaryModule.hs-boot b/message-index/messages/GHC-91999/example1/after/BootModuleDataTypeNotInOrdinaryModule.hs-boot new file mode 100644 index 00000000..3d5071b7 --- /dev/null +++ b/message-index/messages/GHC-91999/example1/after/BootModuleDataTypeNotInOrdinaryModule.hs-boot @@ -0,0 +1,3 @@ +module BootModuleDataTypeNotInOrdinaryModule where + +data BootModuleOnlyDataType = BootModuleOnlyDataType String diff --git a/message-index/messages/GHC-91999/example1/after/ImportBootModule.hs b/message-index/messages/GHC-91999/example1/after/ImportBootModule.hs new file mode 100644 index 00000000..40bfada9 --- /dev/null +++ b/message-index/messages/GHC-91999/example1/after/ImportBootModule.hs @@ -0,0 +1,3 @@ +module ImportBootModule where + +import {-# SOURCE #-} BootModuleDataTypeNotInOrdinaryModule diff --git a/message-index/messages/GHC-91999/example1/before/BootModuleDataTypeNotInOrdinaryModule.hs b/message-index/messages/GHC-91999/example1/before/BootModuleDataTypeNotInOrdinaryModule.hs new file mode 100644 index 00000000..c872f543 --- /dev/null +++ b/message-index/messages/GHC-91999/example1/before/BootModuleDataTypeNotInOrdinaryModule.hs @@ -0,0 +1,4 @@ +module BootModuleDataTypeNotInOrdinaryModule where + +-- Defined only in the .hs-boot version of this module +-- data BootModuleOnlyDataType = BootModuleOnlyDataType String diff --git a/message-index/messages/GHC-91999/example1/before/BootModuleDataTypeNotInOrdinaryModule.hs-boot b/message-index/messages/GHC-91999/example1/before/BootModuleDataTypeNotInOrdinaryModule.hs-boot new file mode 100644 index 00000000..3d5071b7 --- /dev/null +++ b/message-index/messages/GHC-91999/example1/before/BootModuleDataTypeNotInOrdinaryModule.hs-boot @@ -0,0 +1,3 @@ +module BootModuleDataTypeNotInOrdinaryModule where + +data BootModuleOnlyDataType = BootModuleOnlyDataType String diff --git a/message-index/messages/GHC-91999/example1/before/ImportBootModule.hs b/message-index/messages/GHC-91999/example1/before/ImportBootModule.hs new file mode 100644 index 00000000..40bfada9 --- /dev/null +++ b/message-index/messages/GHC-91999/example1/before/ImportBootModule.hs @@ -0,0 +1,3 @@ +module ImportBootModule where + +import {-# SOURCE #-} BootModuleDataTypeNotInOrdinaryModule diff --git a/message-index/messages/GHC-91999/example1/index.md b/message-index/messages/GHC-91999/example1/index.md new file mode 100644 index 00000000..04a8eec5 --- /dev/null +++ b/message-index/messages/GHC-91999/example1/index.md @@ -0,0 +1,26 @@ +--- +title: Boot module has a datatype which isn't in its corresponding ordinary module +--- + +In this example, we define a datatype `BootModuleOnlyDataType` in +`BootModuleDataTypeNotInOrdinaryModule.hs-boot`. + +Compile the example files like so: + +```sh +ghc -c BootModuleDataTypeNotInOrdinaryModule.hs-boot +ghc -c ImportBootModule.hs +ghc -c BootModuleDataTypeNotInOrdinaryModule.hs +``` + +In the before case, where we defined the datatype `BootModuleOnlyDataType` only +in `BootModuleDataTypeNotInOrdinaryModule.hs-boot`, we compile the modules like +so and receive the following error: + +``` +: error: + ‘BootModuleDataTypeNotInOrdinaryModule.BootModuleOnlyDataType’ is exported by the hs-boot file, but not exported by the module +``` + +In the after case, we add the datatype to +`BootModuleDataTypeNotInOrdinaryModule.hs`, and the error disappears. diff --git a/message-index/messages/GHC-91999/index.md b/message-index/messages/GHC-91999/index.md new file mode 100644 index 00000000..110b572e --- /dev/null +++ b/message-index/messages/GHC-91999/index.md @@ -0,0 +1,11 @@ +--- +title: Missing Boot Export +summary: An hs-boot file exports a datatype that isn't found in its corresponding .hs file +severity: error +introduced: 9.8.1 +--- + +Any datatype that is exported from an .hs-boot file must be exported from the +corresponding .hs file. + +More information on .hs-boot modules is available in [the GHC user manual](https://downloads.haskell.org/ghc/latest/docs/users_guide/separate_compilation.html#how-to-compile-mutually-recursive-modules).