[GHC] #2024: Template Haskell doesn't work well with Lexically Scoped Type Variables

GHC trac at galois.com
Mon Jan 7 20:30:31 EST 2008


#2024: Template Haskell doesn't work well with Lexically Scoped Type Variables
---------------------------------+------------------------------------------
    Reporter:  fons              |       Owner:         
        Type:  bug               |      Status:  new    
    Priority:  normal            |   Milestone:         
   Component:  Template Haskell  |     Version:  6.8.2  
    Severity:  normal            |    Keywords:         
  Difficulty:  Unknown           |    Testcase:         
Architecture:  Unknown           |          Os:  Unknown
---------------------------------+------------------------------------------
 I don't know if TH is meant to work properly with LSTV. I don't personally
 need it and I run into this bug by chance, but at least I think that the
 error should be friendlier in any case. See this (pretty stupid, sorry)
 example.

 Foo.hs
 {{{
 {-# LANGUAGE TemplateHaskell, ScopedTypeVariables #-}
 module Foo where


 myid :: forall a . a -> a
 myid = $([| (\x -> x) :: (a -> a) |])
 }}}

 Ghci shows this user-unfriendly error:


 {{{
 $ ghci Foo.hs
 GHCi, version 6.8.2: http://www.haskell.org/ghc/  :? for help
 Loading package base ... linking ... done.
 [1 of 1] Compiling Foo              ( Foo.hs, interpreted )

 Foo.hs:6:12:
     DsMeta: failed binder lookup when desugaring a TH bracket: a
 Failed, modules loaded: none.
 Prelude>
 }}}

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


More information about the Glasgow-haskell-bugs mailing list