capability
capability copied to clipboard
Deriving tagged instances requires `PolyKinds`
Deriving tagged instances requires the PolyKinds or TypeInType extension to be enabled. E.g. the following code
newtype MyState a = MyState (State Int a)
deriving (Functor, Applicative, Monad)
deriving (HasState "foo" Int) via
MonadState (State Int)
raises compiler errors of the form
Illegal kind: ([] :: [] ghc-prim-0.5.3:GHC.Types.RuntimeRep)
Did you mean to enable PolyKinds?
This is likely due to the use of Proxy# in HasState's methods. #15073 might be related.
Having to enable PolyKinds can be a nuisance, because it may require the user to provide additional kind signatures in the affected module. See https://github.com/tweag/capabilities-via/pull/4#discussion_r208977629.
For what it's worth, I prefer using TypeInType systematically. PolyKinds is, I believe, more or less on a path to deprecation anyway.