capability icon indicating copy to clipboard operation
capability copied to clipboard

Deriving tagged instances requires `PolyKinds`

Open aherrmann opened this issue 7 years ago • 1 comments

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.

aherrmann avatar Aug 09 '18 16:08 aherrmann

For what it's worth, I prefer using TypeInType systematically. PolyKinds is, I believe, more or less on a path to deprecation anyway.

aspiwack avatar Aug 10 '18 07:08 aspiwack