[GHC] #14498: GHC internal error: "not in scope during TC but it passed the renamer"

GHC ghc-devs at haskell.org
Sun Dec 3 04:48:17 UTC 2017


#14498: GHC internal error: "not in scope during TC but it passed the renamer"
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.2.1
  checker)                           |             Keywords:
      Resolution:                    |  PatternSynonyms
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash or panic                     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #14288            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by goldfire):

 What about this example:

 {{{#!hs
 data Ex = forall a. C a => MkEx (Proxy a) (F a)

 class C a where
   type F a
   type G a
   meth :: F a -> G a

 pattern P :: () => forall a. C a => G a -> Ex
 pattern P x <- MkEx _ (meth @a -> x)
 }}}

 Note that `meth`'s type is ambiguous, and thus we want to specialize it to
 the existential variable `a`. You might argue that we could bring `a` into
 scope by matching on the `Proxy` argument -- and you'd be right -- but
 that's akin to arguing that `forall` should never bring variables into
 scope in the bodies of definition because you can (almost) always use a
 pattern signature to bring a type variable into scope. I thus claim that
 bringing existentials into scope in pattern synonyms is indeed useful.

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


More information about the ghc-tickets mailing list