Can't put quantified constraint in type synonym
Summary
Can't put a quantified constraint in a type synonym.
Steps to reproduce
Put the following into a file test.hs
, then run ghci test.hs
:
{-# LANGUAGE
RankNTypes,
QuantifiedConstraints,
ConstraintKinds #-}
module Foo where
type Foo f = (forall s. Semigroup s => Semigroup (f s))
You get the error:
[1 of 1] Compiling Foo ( test.hs, interpreted )
test.hs:8:40: error:
• Expected a type, but ‘Semigroup (f s)’ has kind ‘Constraint’
• In the type ‘(forall s. Semigroup s => Semigroup (f s))’
In the type declaration for ‘Foo’
|
8 | type Foo f = (forall s. Semigroup s => Semigroup (f s))
| ^^^^^^^^^^^^^^^
Failed, no modules loaded.
Expected behavior
It should compile, and the type synonym Foo
should have kind Foo :: (* -> *) -> Constraint
.
Environment
- GHC version used: 8.6.5