Skip to content

Commit e43f093

Browse files
Add GHC-24922 (#501)
1 parent 415e77c commit e43f093

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{-# LANGUAGE TemplateHaskell #-}
2+
3+
module CannotReifyOutOfScopeThing where
4+
5+
import Language.Haskell.TH
6+
7+
doesn'tExist = "I do so!"
8+
9+
do t <- reifyType (mkName "doesn'tExist")
10+
return []
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{-# LANGUAGE TemplateHaskell #-}
2+
3+
module CannotReifyOutOfScopeThing where
4+
5+
import Language.Haskell.TH
6+
7+
do t <- reifyType (mkName "doesn'tExist")
8+
return []
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: Cannot reify type because name is not in scope
3+
---
4+
5+
GHC fails with an error because the requested name is not in scope.
6+
7+
## Error Message
8+
9+
```haskell
10+
CannotReifyOutOfScopeThing.hs:7:1: error: [GHC-24922]
11+
doesn'tExist is not in scope at a reify
12+
|
13+
7 | do t <- reifyType (mkName "doesn'tExist")
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
15+
```
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: Cannot reify type because name is not in scope
3+
summary: A Template Haskell error indicating that the given name is not in scope and therefore cannot be reified.
4+
severity: error
5+
introduced: 9.6.1
6+
---
7+
8+
The [Template Haskell] [`reifyType`][haddock-reifyType] function
9+
returns the type or kind of a given name:
10+
11+
```haskell
12+
reifyType :: Name -> Q Type
13+
```
14+
15+
If the name is not in scope, GHC fails with error **GHC-24922**.
16+
The name has possibly been misspelled, or needs to be defined or
17+
brought into scope.
18+
19+
[Template Haskell]: https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/template_haskell.html
20+
[haddock-reifyType]: https://hackage.haskell.org/package/template-haskell-2.22.0.0/docs/Language-Haskell-TH.html#v:reifyType

0 commit comments

Comments
 (0)