
#15471: Polymorphism, typed splices and type inference don't mix -------------------------------------+------------------------------------- Reporter: mpickering | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Template Haskell | Version: 8.4.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Well, we have {{{ teset_foo :: forall p. Q (TExp (p -> p)) }}} When we run a top-level splice, as in `$$(test_foo)`, we're going to run it at compile time; it's like running it in GHCi; it must be a closed expression. So GHC must pick a type to instantiate `p`; and it chooses `Any`. After all, `test_foo` could also have type {{{ test_foo :: forall p. Num p => p -> Q (TExp (p -> p)) }}} and now we must pick a `Num` dictionary to pass to it. I think what you want is for `test_foo` to have type {{{ test_foo :: Q (TExp (forall p. p->p)) }}} but we can't do that. Yet anyway. For a start it'd require impredicative polymorphism. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15471#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler