Ticket #2024 (closed merge: fixed)

Opened 5 years ago

Last modified 5 years ago

Template Haskell doesn't work well with Lexically Scoped Type Variables

Reported by: fons Owned by: igloo
Priority: normal Milestone:
Component: Template Haskell Version: 6.8.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: TH_scopedTvs Blocked By:
Blocking: Related Tickets:

Description

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>

Change History

Changed 5 years ago by simonpj

  • owner set to igloo
  • testcase set to TH_scopedTvs
  • type changed from bug to merge

Thanks. Fixed by

Wed Jan 16 15:16:12 GMT 2008  simonpj@microsoft.com
  * Complain sensibly if you try to use scoped type variables in Template Haskell

Ian: pls merge this across.

Simon

Changed 5 years ago by igloo

  • status changed from new to closed
  • resolution set to fixed

Merged

Changed 5 years ago by simonmar

  • architecture changed from Unknown to Unknown/Multiple

Changed 5 years ago by simonmar

  • os changed from Unknown to Unknown/Multiple
Note: See TracTickets for help on using tickets.