为什么 GHC 会产生以下类型的错误消息?

Why does GHC produce the following kind error message?

给定以下程序:

{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE FlexibleInstances #-}

import Control.Monad.Reader

newtype AppM a = AppM (ReaderT Int IO a)
  deriving (Functor, Applicative, Monad, MonadReader)

MonadReader 派生声明应为 MonadReader Int。 GHC 产生以下错误消息:

Expecting one more argument to ‘MonadReader’
Expected kind ‘* -> ghc-prim-0.4.0.0:GHC.Prim.Constraint’,
  but ‘MonadReader’ has kind ‘*
                              -> (* -> *) -> ghc-prim-0.4.0.0:GHC.Prim.Constraint’
In the newtype declaration for ‘AppM’

这个错误消息让我很困惑。 MonadReader 的种类是 * -> (* -> *) -> GHC.Prim.Constraint,如错误消息所述,这是有道理的。但是,错误消息指出它 期望 种类 * -> GHC.Prim.Constraint,尽管 MonadReader Int 实际上是种类 (* -> *) -> GHC.Prim.Constraint

鉴于类型 ** -> * 不匹配,此错误消息不仅误导了我,而且实际上是不正确的。这是错误,还是我忽略了此错误消息中的某些内容?

As , this was a bug. Alexis King opened this ticket,四个月前已按固定方式关闭。