Instances with GHC.TypeLits.Nat/Symbol should be possible without FlexibleInstances.
Yes I know, 0 and "B" are not technically type constructors, but it's as close as you can get for the kinds Nat and Symbol.
Test cases:
{-# LANGUAGE DataKinds, KindSignatures #-}
import GHC.TypeLits (Nat, Symbol)
class A (n::Nat)
instance A 0
class B (s::Symbol)
instance B "B"
Result:
A.hs:6:10: error:
• Illegal instance declaration for ‘A 0’
(All instance types must be of the form (T a1 ... an)
where a1 ... an are *distinct type variables*,
and each type variable appears at most once in the instance head.
Use FlexibleInstances if you want to disable this.)
• In the instance declaration for ‘A 0’
A.hs:9:10: error:
• Illegal instance declaration for ‘B "B"’
(All instance types must be of the form (T a1 ... an)
where a1 ... an are *distinct type variables*,
and each type variable appears at most once in the instance head.
Use FlexibleInstances if you want to disable this.)
• In the instance declaration for ‘B "B"’
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.0.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | low |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |