[GHC] #10697: Change template-haskell API to allow NOUNPACK, lazy annotations
GHC
ghc-devs at haskell.org
Tue Dec 8 20:53:36 UTC 2015
#10697: Change template-haskell API to allow NOUNPACK, lazy annotations
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Template Haskell | Version: 7.10.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #5290, #8347 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):
* cc: adamse (added)
Comment:
It turns out that even without considering `NOUNPACK`, `Strict` and
`TemplateHaskell` don't play well together at the moment. This code:
{{{#!hs
{-# LANGUAGE StrictData, TemplateHaskell #-}
import Language.Haskell.TH
data T a = T !a a ~a
$(return [])
main :: IO ()
main = putStrLn $(reify ''T >>= stringE . show)
}}}
produces this output (prettied up a bit):
{{{#!hs
TyConI (DataD [] Main.T [KindedTV a_1627391747 StarT]
[NormalC Main.T [ (IsStrict, VarT a_1627391747)
, (NotStrict,VarT a_1627391747)
, (NotStrict,VarT a_1627391747)
]] [])
}}}
Which is pretty darn misleading, since the second argument is actually
strict!
That being said, I'm not exactly sure what it ''should'' output here. One
might could argue is should be `(IsStrict, NotStrict, IsLazy)`, but then
again, the definition of `NotStrict` depends on whether `StrictData` is
enabled or not.
If we output `(Strict, NotStrict, IsLazy)`, then would splicing the TH
code for that datatype into a module without `StrictData` fail (since
`IsLazy` implies a laziness annotation)? Perhaps TH should check whether
`StrictData` is on and splice accordingly.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10697#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list