[GHC] #10019: GHCi cannot reify a custom data constructor with Template Haskell on the first attempt
GHC
ghc-devs at haskell.org
Sun Jan 25 04:18:22 UTC 2015
#10019: GHCi cannot reify a custom data constructor with Template Haskell on the
first attempt
-------------------------------------+-------------------------------------
Reporter: | Owner:
RyanGlScott | Status: new
Type: bug | Milestone:
Priority: normal | Version: 7.8.4
Component: Template | Operating System: Unknown/Multiple
Haskell | Type of failure: GHC rejects
Keywords: | valid program
Architecture: | Blocked By:
Unknown/Multiple | Related Tickets:
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
I've uncovered an unusual bug with Template Haskell inside of GHCi. To
duplicate it, load GHCi, create a data type, then attempt to reify one of
its constructors. It will fail the first time, but succeed the second
time.
{{{
$ ghci -XTemplateHaskell
GHCi, version 7.8.4: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
λ> import Language.Haskell.TH
λ> data Option a = Some a | None
λ> $(reify 'Some >>= stringE . show)
Failed to load interface for ‘Ghci1’
no package matching ‘interactive’ was found
λ> $(reify 'Some >>= stringE . show)
Loading package array-0.5.0.0 ... linking ... done.
Loading package deepseq-1.3.0.2 ... linking ... done.
Loading package containers-0.5.5.1 ... linking ... done.
Loading package pretty-1.1.1.1 ... linking ... done.
Loading package template-haskell ... linking ... done.
"DataConI Ghci1.Some (ForallT [PlainTV a_1627392303] [] (AppT (AppT ArrowT
(VarT a_1627392303)) (AppT (ConT Ghci1.Option) (VarT a_1627392303))))
Ghci1.Option (Fixity 9 InfixL)"
}}}
Curiously, this doesn't happen when you reify a data constructor in
{{{base}}}, such as {{{Just}}}:
{{{
$ ghci -XTemplateHaskell
GHCi, version 7.8.4: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
λ> import Language.Haskell.TH
λ> $(reify 'Just >>= stringE . show)
Loading package array-0.5.0.0 ... linking ... done.
Loading package deepseq-1.3.0.2 ... linking ... done.
Loading package containers-0.5.5.1 ... linking ... done.
Loading package pretty-1.1.1.1 ... linking ... done.
Loading package template-haskell ... linking ... done.
"DataConI Data.Maybe.Just (ForallT [PlainTV a_1627398816] [] (AppT (AppT
ArrowT (VarT a_1627398816)) (AppT (ConT Data.Maybe.Maybe) (VarT
a_1627398816)))) Data.Maybe.Maybe (Fixity 9 InfixL)"
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10019>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list