[GHC] #15471: Polymorphism, typed splices and type inference don't mix

GHC ghc-devs at haskell.org
Fri Aug 3 14:30:28 UTC 2018


#15471: Polymorphism, typed splices and type inference don't mix
-------------------------------------+-------------------------------------
           Reporter:  mpickering     |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.6.1
          Component:  Compiler       |           Version:  8.4.3
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Trying to quote and splice a polymorphic function doesn't work unless you
 have a type signature.

 {{{
 {-# LANGUAGE TemplateHaskell #-}
 module A where

 foo1 x = x

 test_foo = [|| foo1 ||]
 }}}

 {{{
 {-# LANGUAGE TemplateHaskell #-}
 module B where

 import A

 qux = $$(test_foo)
 }}}

 The type of `qux` is `Any -> Any`! Which is clearly wrong.

 Adding a type signature to `qux` fixes the problem.

 {{{
 qux :: a -> a
 qux = $$(test_foo)
 }}}

 Either there should be a better error or this should just work.

 It seems that this has always been broken. Ryan tested on GHC 7.8.4 for
 me.

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


More information about the ghc-tickets mailing list