GeneralizedNewtypeDeriving sometimes needs RankNTypes
Consider
{-# LANGUAGE RankNTypes #-}
module A where
class C m where
foo :: (forall b. b -> m b) -> c -> m c
instance C [] where
foo f c = f c
and
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module B where
import A
newtype MyList a = Mk [a]
deriving C
When I compile B.hs, I get
Illegal polymorphic or qualified type: forall b. b -> MyList b
Perhaps you intended to use RankNTypes or Rank2Types
In an expression type signature:
forall (c :: *). (forall (b :: *). b -> MyList b) -> c -> MyList c
In the expression:
GHC.Prim.coerce
(foo :: (forall (b :: *). b -> [] b) -> c -> [] c) ::
forall (c :: *). (forall (b :: *). b -> MyList b) -> c -> MyList c
In an equation for ‛foo’:
foo
= GHC.Prim.coerce
(foo :: (forall (b :: *). b -> [] b) -> c -> [] c) ::
forall (c :: *). (forall (b :: *). b -> MyList b) -> c -> MyList c
I will fix shortly.
Trac metadata
Trac field | Value |
---|---|
Version | 7.8.1-rc1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |