
#9301: Rank-2 constraints are assigned kind * -------------------------------------+------------------------------------ Reporter: heisenbug | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Description changed by heisenbug: Old description:
Compile this program with GHC-HEAD (I have 7.9.20140605, but I guess 7.8.3 will also do): {{{ {-# LANGUAGE RankNTypes #-}
strangelet :: (forall t . Num t) => () strangelet = \_ -> () }}}
Very strangely it gets accepted! {{{ *Main> :t strangelet strangelet :: (forall t. Num t) -> () }}} I suspect that the type checker assigns kind `*` to rank-2 constraints. Of course it should assign a `Constraint` kind.
What I ultimately want is to declare: {{{ foo :: (Monad m, forall n . Num (m n)) => m n foo = ... }}} ..or such. Would that be unreasonable?
NB: 7.4.2 rejects it (even with `-XConstraintKinds`). I did not try 7.6.3.
New description: Compile this program with GHC-HEAD (I have 7.9.20140605, but I guess 7.8.3 will also do): {{{ {-# LANGUAGE RankNTypes #-} strangelet :: (forall t . Num t) => () strangelet = \_ -> () }}} Very strangely it gets accepted! {{{ *Main> :t strangelet strangelet :: (forall t. Num t) -> () }}} I suspect that the type checker assigns kind `*` to rank-2 constraints. Of course it should assign a `Constraint` kind. What I ultimately want is to declare: {{{ foo :: (Monad m, forall n . Num (m n)) => m n foo = ... }}} ...or such. Would that be unreasonable? NB: 7.4.2 rejects it (even with `-XConstraintKinds`). I did not try 7.6.3. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9301#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler