[GHC] #15360: Template Haskell splicing drops lots of type arguments

GHC ghc-devs at haskell.org
Wed Jul 11 18:58:34 UTC 2018


#15360: Template Haskell splicing drops lots of type arguments
-------------------------------------+-------------------------------------
           Reporter:  goldfire       |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.6.1
          Component:  Template       |           Version:  8.4.3
  Haskell                            |
           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:
-------------------------------------+-------------------------------------
 The conversion functions (in the `Convert` module) drop type arguments in
 various places.

 Here are two examples:

 {{{
 data T a b c = Mk a b c

 bar :: $( return $ AppT (InfixT (ConT ''Int) ''T (ConT ''Bool)) (ConT
 ''Double) )
 bar = Mk 5 True 3.14
 }}}

 This correct code leads to an error

 {{{
 Expecting one more argument to ‘T Int Bool’
 }}}

 because the `Double` is forgotten.

 Similarly,

 {{{
 baz :: $( return $ AppT (ParensT (ConT ''Maybe)) (ConT ''Int) )
 baz = Just 5
 }}}

 fails because `baz :: (Maybe)` isn't valid.

 On the other hand,

 {{{
 frob :: forall (a :: $( [t| * Int |] )). a -> a
 frob x = x
 }}}

 is spuriously accepted, because GHC has forgotten about the `Int`
 argument.

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


More information about the ghc-tickets mailing list