Opened 5 months ago

Closed 4 months ago

#8577 closed bug (fixed)

Polymorphism and typed TH

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



data A a = A
x = [||A||]
y = x :: Q (TExp (A Int))

$$x is given type A a, as expected. However, $$y is also given type A a. I would expect it to be A Int. In other words, given p :: Q (TExp T1), $$p :: T2 I think GHC should verify the equation T1 ~ T2.

Change History (3)

comment:1 Changed 4 months ago by Simon Peyton Jones <simonpj@…>

In 8b642debfabe00377f47d461d31d70636bf0fce3/ghc:

Typecheck typed TH splices properly (fix Trac #8577)

This was an egregious error.  If e :: T (Q ty1)
then when we have the splice

     $e :: ty2

we must ensure that ty1~ty2 before we even think about
running the splice!

I took the opportunity to remove the dead-code tcSpliceDecls

comment:2 Changed 4 months ago by Simon Peyton Jones <simonpj@…>

comment:3 Changed 4 months ago by simonpj

  • Resolution set to fixed
  • Status changed from new to closed

Good catch! A terrible bug. Thanks.


Note: See TracTickets for help on using tickets.