[GHC] #7880: Require "forall" in definitions of polymorphic types

GHC cvs-ghc at haskell.org
Thu May 2 19:26:38 CEST 2013


#7880: Require "forall" in definitions of polymorphic types
---------------------------------+------------------------------------------
    Reporter:  monoidal          |       Owner:                             
        Type:  bug               |      Status:  new                        
    Priority:  normal            |   Milestone:                             
   Component:  Compiler          |     Version:  7.6.3                      
    Keywords:                    |          Os:  Unknown/Multiple           
Architecture:  Unknown/Multiple  |     Failure:  GHC accepts invalid program
  Difficulty:  Unknown           |    Testcase:                             
   Blockedby:                    |    Blocking:                             
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by monoidal):

 Both in current GHC and in this proposal `f` means

 {{{
 f :: forall a. (Num a => a -> a) -> Int
 }}}

 This is rather intuitive; if we write

 {{{
 g :: (Num a => a -> a) -> a
 }}}

 then it's clear that "forall a" should apply outside the parentheses. It
 would be a bit strange if changing "Int" to "a" changed the place where we
 the implicit quantifier appears. So, as far as I know, implicit
 quantification already occurs only at the top level of type expressions,
 and this change would only reject programs that use => for implicit
 quantification in type definitions (which is easy to fix by adding
 "forall").

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7880#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list