[GHC] #8388: forall on non-* types

GHC ghc-devs at haskell.org
Mon Sep 30 21:06:22 CEST 2013


#8388: forall on non-* types
------------------------------------+-------------------------------------
       Reporter:  monoidal          |             Owner:
           Type:  bug               |            Status:  new
       Priority:  normal            |         Milestone:
      Component:  Compiler          |           Version:  7.6.3
       Keywords:                    |  Operating System:  Unknown/Multiple
   Architecture:  Unknown/Multiple  |   Type of failure:  None/Unknown
     Difficulty:  Unknown           |         Test Case:
     Blocked By:                    |          Blocking:
Related Tickets:                    |
------------------------------------+-------------------------------------
 This code

 {{{
 {-# LANGUAGE RankNTypes, ImpredicativeTypes #-}
 x = Nothing :: (forall a. Maybe) Int
 }}}

 gives

 {{{
     Couldn't match type `Maybe' with `forall a. Maybe'
     Expected type: forall a. Maybe Int
       Actual type: Maybe Int
 }}}

 which does not seem correct. There are two options:

 Option A: We allow this.

 Option B: We reject this as ill-kinded and allow `forall a. T` only when
 `T` has kind `*`. I prefer this option; in theory this can break existing
 code, but I am not aware of any code that uses forall on non-* type
 (please correct me if I'm wrong), and e.g. this means `forall a. a`
 inhabits every kind, for example `Bool`.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8388>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list