[GHC] #11101: Expand Template Haskell type splices before quantification

GHC ghc-devs at haskell.org
Tue Nov 17 11:11:50 UTC 2015


#11101: Expand Template Haskell type splices before quantification
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by simonpj:

Old description:

> Consider
> {{{
> f :: Int -> $(foo)
> f = ...
> }}}
> This is a Template Haskell type splice. What if `$(foo)` expands to `a ->
> a`.  Then it should all behave as if you'd written
> {{{
> f :: Int -> a -> a
> f = ...
> }}}
> But it doesn't, because we collect the variables over which we will
> implicitly quantify ''before expanding splices''.
>
> This is made yet more tricky when we add type wildcards to the mix.
>
> And really there is no good reason for this trouble.  We should simply
> expand the splice, and ''then'' decide what to quantify over. A little
> bit of refactoring in `RnTypes`.
>
> This ticket is just to record that I intend to do this shortly.

New description:

 Consider
 {{{
 f :: Int -> $(foo)
 f = ...
 }}}
 This is a Template Haskell type splice. What if `$(foo)` expands to `a ->
 a`.  Then it should all behave as if you'd written
 {{{
 f :: Int -> a -> a
 f = ...
 }}}
 But it doesn't, because we collect the variables over which we will
 implicitly quantify ''before expanding splices''.

 This is made yet more tricky when we add type wildcards to the mix.

 And really there is no good reason for this trouble.  We should simply
 expand the splice, and ''then'' decide what to quantify over. A little bit
 of refactoring in `RnTypes`.

 This ticket is just to record that I intend to do this shortly.

 It's possible that #11098 is related; I'm not sure.

--

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


More information about the ghc-tickets mailing list