[GHC] #14888: The (->) type doesn't survive a TH quote-splice roundtrip

GHC ghc-devs at haskell.org
Sun Mar 4 03:10:34 UTC 2018


#14888: The (->) type doesn't survive a TH quote-splice roundtrip
-------------------------------------+-------------------------------------
           Reporter:  RyanGlScott    |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Template       |           Version:  8.2.2
  Haskell                            |
           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:
-------------------------------------+-------------------------------------
 You can roundtrip function types like `Bool -> Bool` through Template
 Haskell splicing:

 {{{
 $ /opt/ghc/8.2.2/bin/ghci -XTemplateHaskell
 GHCi, version 8.2.2: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 λ> :m + Language.Haskell.TH
 λ> :k $([t| Bool -> Bool |])
 $([t| Bool -> Bool |]) :: *
 }}}

 However, GHC doesn't offer the same courtesy to `(->)` applied prefix, as
 in the following example:

 {{{
 λ> :k $([t| (->) Bool Bool |])

 <interactive>:1:3: error:
     • Illegal type constructor or class name: ‘(->)’
       When splicing a TH type:
         GHC.Prim.(->) GHC.Types.Bool GHC.Types.Bool
     • In the untyped splice: $([t| (->) Bool Bool |])
 }}}

 One way to fix this would be to consistently desugar `(->)` to `ArrowT` in
 `DsMeta` (instead of leaving it as `GHC.Prim.(->)`).

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


More information about the ghc-tickets mailing list