Skip to content

Commit c1e66db

Browse files
Add GHC-45906 (#508)
1 parent 158a412 commit c1e66db

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{-# LANGUAGE GHC2021 #-}
2+
3+
module SAKS where
4+
5+
import Data.Kind (Type)
6+
7+
type T :: Type
8+
data T
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{-# LANGUAGE Haskell2010 #-}
2+
3+
module SAKS where
4+
5+
import Data.Kind (Type)
6+
7+
type T :: Type
8+
data T
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: Illegal standalone kind signature
3+
---
4+
5+
Module fails to compile because it contains a standalone type
6+
signature.
7+
8+
## Error Message
9+
10+
```haskell
11+
SAKS.hs:7:1: error: [GHC-45906]
12+
Illegal standalone kind signature
13+
Suggested fix:
14+
Perhaps you intended to use the StandaloneKindSignatures extension (implied by UnliftedDatatypes)
15+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: Illegal standalone kind signature
3+
summary: Program contains a standalone kind signature, but the active extensions do not allow it.
4+
severity: error
5+
introduced: 9.6.1
6+
---
7+
8+
[Standalone kind signatures] can be used to specify a polymorphic
9+
kind for a type, to overcome kind inference restrictions:
10+
11+
```haskell
12+
type T :: (k -> Type) -> k -> Type -- standalone kind signature
13+
data T m a = MkT (m a) (T Maybe (m a))
14+
```
15+
16+
Without the standalone kind signature, GHC would infer the kind
17+
`T :: (Type -> Type) -> Type -> Type`.
18+
19+
Use of this feature requires the `StandaloneKindSignatures`
20+
extension to be enabled. This extension is implied by
21+
`UnliftedDatatypes`, and included in the `GHC2021` and `GHC2024`
22+
language editions.
23+
24+
[Standalone kind signatures]: https://downloads.haskell.org/ghc/9.12.1/docs/users_guide/exts/poly_kinds.html#standalone-kind-signatures-and-polymorphic-recursion

0 commit comments

Comments
 (0)