[GHC] #13642: GHCi 8.2 simply ignores TH splice using datatype with a forall'd kind signature

GHC ghc-devs at haskell.org
Wed May 3 20:16:15 UTC 2017


#13642: GHCi 8.2 simply ignores TH splice using datatype with a forall'd kind
signature
-------------------------------------+-------------------------------------
           Reporter:  RyanGlScott    |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Template       |           Version:  8.2.1-rc1
  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:
-------------------------------------+-------------------------------------
 This is a pretty bizarre behavior I've noticed recently that only happens
 in GHC 8.2 or later. If you try to use a Template Haskell splice with a
 very particular feature (a datatype whose kind uses `forall`) in GHCi,
 then GHCi will flat-out ignore it!

 {{{
 $ /opt/ghc/8.2.1/bin/ghci
 GHCi, version 8.2.0.20170427: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 λ> :set -XGADTs -XTypeInType -XTemplateHaskell -XRankNTypes
 λ> import Language.Haskell.TH (stringE, pprint)
 λ> import Data.Kind (Type)
 λ> $([d| data Foo :: forall a. a -> Type where MkFoo :: Foo Int |] >>=
 stringE . pprint)
 λ> print (5 + length $([d| data Foo :: forall a. a -> Type where MkFoo ::
 Foo Int |] >>= stringE . pprint))
 λ> 5
 5
 λ> it
 5
 λ> $([d| data Foo :: forall a. a -> Type where MkFoo :: Foo Int |] >>=
 stringE . pprint)
 λ> it
 5
 }}}

 Notice how none of my attempts to use the splice seemed to register with
 GHCi.

 This isn't really a regression //per se//, since GHC 8.0.1 nor 8.0.2 even
 allowed you to get that far:

 {{{
 $ /opt/ghc/8.0.2/bin/ghci
 GHCi, version 8.0.2: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 λ> :set -XGADTs -XTypeInType -XTemplateHaskell -XRankNTypes
 λ> import Language.Haskell.TH (stringE, pprint)
 λ> import Data.Kind (Type)
 λ> $([d| data Foo :: forall a. a -> Type where MkFoo :: Foo Int |] >>=
 stringE . pprint)

 <interactive>:4:3: error:
     Exotic form of kind not (yet) handled by Template Haskell
       forall a. a -> Type
 }}}

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


More information about the ghc-tickets mailing list