Skip to content

Commit

Permalink
add GHC-24922
Browse files Browse the repository at this point in the history
  • Loading branch information
frasertweedale committed Jun 6, 2024
1 parent cc1f169 commit bd4645f
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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 []
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{-# LANGUAGE TemplateHaskell #-}

module CannotReifyOutOfScopeThing where

import Language.Haskell.TH

do t <- reifyType (mkName "doesn'tExist")
return []
15 changes: 15 additions & 0 deletions message-index/messages/GHC-24922/example/index.md
Original file line number Diff line number Diff line change
@@ -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")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
```
20 changes: 20 additions & 0 deletions message-index/messages/GHC-24922/index.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bd4645f

Please sign in to comment.