Rework Template Haskell's handling of strictness
authorRyanGlScott <ryan.gl.scott@gmail.com>
Tue, 22 Dec 2015 10:25:59 +0000 (11:25 +0100)
committerBen Gamari <ben@smart-cactus.org>
Tue, 22 Dec 2015 12:22:29 +0000 (13:22 +0100)
commitf975b0b10b2971d00b6e1986e0a2af2bf759a4f4
tree8b890f6e8058bb0a625a409de70f107101048d8d
parentb407bd775d9241023b4694b3142a756df0082ea2
Rework Template Haskell's handling of strictness

Currently, Template Haskell's treatment of strictness is not enough to
cover all possible combinations of unpackedness and strictness. In
addition, it isn't equipped to deal with new features (such as
`-XStrictData`) which can change a datatype's fields' strictness during
compilation.

To address this, I replaced TH's `Strict` datatype with
`SourceUnpackedness` and `SourceStrictness` (which give the programmer a
more complete toolkit to configure a datatype field's strictness than
just `IsStrict`, `IsLazy`, and `Unpack`). I also added the ability to
reify a constructor fields' strictness post-compilation through the
`reifyConStrictness` function.

Fixes #10697.

Test Plan: ./validate

Reviewers: simonpj, goldfire, bgamari, austin

Reviewed By: goldfire, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1603

GHC Trac Issues: #10697
37 files changed:
compiler/deSugar/DsMeta.hs
compiler/hsSyn/Convert.hs
compiler/prelude/THNames.hs
compiler/typecheck/TcSplice.hs
docs/users_guide/7.12.1-notes.rst
libraries/ghci/GHCi/Message.hs
libraries/ghci/GHCi/TH.hs
libraries/ghci/GHCi/TH/Binary.hs
libraries/template-haskell/Language/Haskell/TH.hs
libraries/template-haskell/Language/Haskell/TH/Lib.hs
libraries/template-haskell/Language/Haskell/TH/Ppr.hs
libraries/template-haskell/Language/Haskell/TH/Syntax.hs
libraries/template-haskell/changelog.md
testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun04.hs
testsuite/tests/rts/T7919A.hs
testsuite/tests/th/T10697_decided_1.hs [new file with mode: 0644]
testsuite/tests/th/T10697_decided_1.stdout [new file with mode: 0644]
testsuite/tests/th/T10697_decided_2.hs [new file with mode: 0644]
testsuite/tests/th/T10697_decided_2.stdout [new file with mode: 0644]
testsuite/tests/th/T10697_decided_3.hs [new file with mode: 0644]
testsuite/tests/th/T10697_decided_3.stdout [new file with mode: 0644]
testsuite/tests/th/T10697_source.hs [new file with mode: 0644]
testsuite/tests/th/T10697_source.stdout [new file with mode: 0644]
testsuite/tests/th/T10697_sourceUtil.hs [new file with mode: 0644]
testsuite/tests/th/T10819_Lib.hs
testsuite/tests/th/T10828.hs
testsuite/tests/th/T10828a.hs
testsuite/tests/th/T10828b.hs
testsuite/tests/th/T5290.hs
testsuite/tests/th/T5290.stderr
testsuite/tests/th/T5665a.hs
testsuite/tests/th/T5984_Lib.hs
testsuite/tests/th/T7532.hs
testsuite/tests/th/T7532.stderr
testsuite/tests/th/T7532a.hs
testsuite/tests/th/TH_genExLib.hs
testsuite/tests/th/all.T