[GHC] #12533: Internal error using redundant forall with default signature

GHC ghc-devs at haskell.org
Wed Aug 24 19:42:11 UTC 2016


#12533: Internal error using redundant forall with default signature
-------------------------------------+-------------------------------------
           Reporter:  dfeuer         |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.0.2
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Compile-time
  Unknown/Multiple                   |  crash
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 {{{#!hs
 {-# LANGUAGE ScopedTypeVariables, DefaultSignatures #-}

 class Foo x where
   foo :: forall a . x a -> x a
   default foo :: forall a . x a -> x a
   foo x = go
     where go :: x a
           go = undefined
 }}}

 GHC (7.8.3 and 8.0.1) chokes on the above with the message

 {{{
 Buggy.hs:7:19: error:
     • GHC internal error: ‘a’ is not in scope during type checking, but it
 passed the renamer
       tcl_env of environment: [aoY :-> Type variable ‘x’ = x,
                                ap0 :-> Type variable ‘a’ = a,
                                ap1 :-> Identifier[x::x a, <NotTopLevel>]]
     • In the first argument of ‘x’, namely ‘a’
       In the type signature:
         go :: x a
       In an equation for ‘foo’:
           foo x
             = go
             where
                 go :: x a
                 go = undefined
 }}}

 If I remove the redundant `forall` it works fine:

 {{{#!hs
 class Foo x where
   foo :: x a -> x a
   default foo :: forall a . x a -> x a
   foo x = go
     where go :: x a
           go = undefined
 }}}

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


More information about the ghc-tickets mailing list