Rank-2 constraints are assigned kind *
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.