
#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 mpickering): Replying to [comment:6 simonpj]:
I'm only saying "it's behaving as specified". (So not a bug in that sense.)
I think you want to propose an extension to the existing behaviour. What is that extension? Specifically, what type do you expect `test_foo` to have?
I don't know what this has to do with static forms, but from your `foo` I get {{{ • No instance for (Typeable a0) arising from a static form • In the expression: static (id :: forall a. a -> a) In an equation for ‘foo’: foo = static (id :: forall a. a -> a) }}}
I think that the type of the quote is fine but problem is during the type checking of typed splices. The fact that the metaocaml example works also supports this I think. The relevance of the static form example is that the type of `static id` should surely follow the same logic as the type of `[|| id ||]`. The inferred type of `static id` is `foo :: forall a . (Typeable a, IsStatic t) => t (a -> a)`. It is then very surprising when the dereferencing/splicing behaviour differs between the cases. {{{ {-# LANGUAGE StaticPointers #-} {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE TemplateHaskell #-} module SP where foo = static id foo2 = [|| id ||] }}} So I don't have a concrete suggestion to what exactly goes wrong but I suspect that the typed splice typechecking code is somehow suspect. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15471#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler