Template Haskell doesn't work well with Lexically Scoped Type Variables
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>
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.8.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Template Haskell |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | Unknown |
| Architecture | Unknown |