
#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: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): The problem is that the info in `HsSrcBangs` may not reflect what is actually going on in some cases. Let's suppose a user wanted to write a TH function that checks if every argument of a data constructor is unpacked. If the user wrote this: {{{#!hs data T = T !Int Int }}} then how would the user know for sure if the fields are actually unpacked? If `-funbox-strict-fields` is on, then the first argument is unpacked, but if not, it's strict but not unpacked. If `-funbox-strict-fields` ''and'' `-XStrict` is on, then ''both'' would be unpacked. But if the user relied on `HsSrcBangs`, they would be mislead into believing that the first argument always is strict (but not unpacked) and the second argument is always lazy. This situation kind of reminds me of TH's `TyVarBndr` in that `PlainTV` represents a type variable without an explicit kind variable, which should only be used during splicing. Afterwards, a kind is inferred, so reifying the datatype back gives you a `KindedTV` instead. Perhaps we should do something similar with strictness annotations? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10697#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler