Why does the GHC generate the following type error message?

Given the following program:

{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE FlexibleInstances #-} import Control.Monad.Reader newtype AppM a = AppM (ReaderT Int IO a) deriving (Functor, Applicative, Monad, MonadReader) 

MonadReader output MonadReader must be MonadReader Int . GHC displays the following error message:

 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' 

This error message is confusing to me. The MonadReader type is * -> (* -> *) -> GHC.Prim.Constraint , as the error message says, which makes sense. However, the error message states that it expects kind * -> GHC.Prim.Constraint , despite the fact that MonadReader Int does look like (* -> *) -> GHC.Prim.Constraint .

Given that the types * and * -> * do not match, this error message not only misleads me, but is actually incorrect. Is this an error, or am I missing something in this error message?

+8
haskell ghc
source share
1 answer

As Tikhon Jelvis said , it was a mistake. Alexis King opened this ticket , which was closed as fixed four months ago.

+2
source share

All Articles