checkValidType is defeated by a type synonym
GHC throws an error message on this code:
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
module Bug where
f :: forall b (a :: Eq b => b). Int
f = 42
$ ~/Software/ghc/inplace/bin/ghc-stage2 --interactive Bug.hs
GHCi, version 8.7.20181211: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
Bug.hs:6:6: error:
• Illegal constraint in a kind: Eq b => b
• In the type signature: f :: forall b (a :: Eq b => b). Int
|
6 | f :: forall b (a :: Eq b => b). Int
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
However, it does //not// throw an error message if you hide Eq b => b
behind a type synonym, as the following variant of the code above is accepted:
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
module Bug where
type Foo b = Eq b => b
f :: forall b (a :: Foo b). Int
f = 42
Trac metadata
Trac field | Value |
---|---|
Version | 8.7 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |