diff --git a/message-index/messages/GHC-24922/example/after/CannotReifyOutOfScopeThing.hs b/message-index/messages/GHC-24922/example/after/CannotReifyOutOfScopeThing.hs new file mode 100644 index 00000000..d2009bb1 --- /dev/null +++ b/message-index/messages/GHC-24922/example/after/CannotReifyOutOfScopeThing.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE TemplateHaskell #-} + +module CannotReifyOutOfScopeThing where + +import Language.Haskell.TH + +doesn'tExist = "I do so!" + +do t <- reifyType (mkName "doesn'tExist") + return [] diff --git a/message-index/messages/GHC-24922/example/before/CannotReifyOutOfScopeThing.hs b/message-index/messages/GHC-24922/example/before/CannotReifyOutOfScopeThing.hs new file mode 100644 index 00000000..313f3a45 --- /dev/null +++ b/message-index/messages/GHC-24922/example/before/CannotReifyOutOfScopeThing.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell #-} + +module CannotReifyOutOfScopeThing where + +import Language.Haskell.TH + +do t <- reifyType (mkName "doesn'tExist") + return [] diff --git a/message-index/messages/GHC-24922/example/index.md b/message-index/messages/GHC-24922/example/index.md new file mode 100644 index 00000000..73021853 --- /dev/null +++ b/message-index/messages/GHC-24922/example/index.md @@ -0,0 +1,15 @@ +--- +title: Cannot reify type because name is not in scope +--- + +GHC fails with an error because the requested name is not in scope. + +## Error Message + +```haskell +CannotReifyOutOfScopeThing.hs:7:1: error: [GHC-24922] + ‘doesn'tExist’ is not in scope at a reify + | +7 | do t <- reifyType (mkName "doesn'tExist") + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^... +``` diff --git a/message-index/messages/GHC-24922/index.md b/message-index/messages/GHC-24922/index.md new file mode 100644 index 00000000..b34ae90d --- /dev/null +++ b/message-index/messages/GHC-24922/index.md @@ -0,0 +1,20 @@ +--- +title: Cannot reify type because name is not in scope +summary: A Template Haskell error indicating that the given name is not in scope and therefore cannot be reified. +severity: error +introduced: 9.6.1 +--- + +The [Template Haskell] [`reifyType`][haddock-reifyType] function +returns the type or kind of a given name: + +```haskell +reifyType :: Name -> Q Type +``` + +If the name is not in scope, GHC fails with error **GHC-24922**. +The name has possibly been misspelled, or needs to be defined or +brought into scope. + +[Template Haskell]: https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/template_haskell.html +[haddock-reifyType]: https://hackage.haskell.org/package/template-haskell-2.22.0.0/docs/Language-Haskell-TH.html#v:reifyType