[GHC] #10697: Change template-haskell API to allow NOUNPACK, lazy annotations

GHC ghc-devs at haskell.org
Thu Dec 10 17:49:25 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:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 Right, I probably should have you'd know all about `HsImplBang`. Better
 safe than sorry. :)

 If no one has any objections, I'd like to take back my earlier proposal
 and instead propose this be the redesign for strictness in TH:

 {{{#!hs
 data SourceStrictness
   = NoSourceStrictness
   | SourceLazy
   | SourceStrict

 data SourceUnpackedness
   = NoSourceUnpackedness
   | SourceNoUnpack
   | SourceUnpack

 data DecidedStrictness
   = DecidedLazy
   | DecidedStrict
   | DecidedUnpack

 data Bang
   = PendingBang SourceStrictness
   | DecidedBang SourceStrictness DecidedStrictness

 type BangType    = (Bang, Type)
 type VarBangType = (Name, Bang, Type)

 type StrictType    = BangType
 type VarStrictType = VarBangType
 }}}

 The tricky part is distinguishing between strictness at the point of
 splicing and strictness post-compilation. I attempt to do this with the
 `Bang` data type, which has two constructors for these purposes. I would
 also propose that attempting to splice in a datatype with a `DecidedBang`
 value would lead to a warning and silently revert to a `PendingBang` value
 (after all, what GHC decides is the right `Bang` completely depends on the
 environment!)

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


More information about the ghc-tickets mailing list