TH: make `Lift` and `TExp` levity-polymorphic
authorAlec Theriault <alec.theriault@gmail.com>
Wed, 17 Apr 2019 15:07:52 +0000 (08:07 -0700)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Fri, 19 Apr 2019 02:52:25 +0000 (22:52 -0400)
commit57cf113302eee6068a1b10cba348f4b7de7faeae
tree3542f990a72d4f3f8bbdd8965e6b2a82d5ea9d75
parent5988f17a799ba3416bb6ed539ae65e1f3fd9f2c0
TH: make `Lift` and `TExp` levity-polymorphic

Besides the obvious benefits of being able to manipulate `TExp`'s of
unboxed types, this also simplified `-XDeriveLift` all while making
it more capable.

  * `ghc-prim` is explicitly depended upon by `template-haskell`

  * The following TH things are parametrized over `RuntimeRep`:

      - `TExp(..)`
      - `unTypeQ`
      - `unsafeTExpCoerce`
      - `Lift(..)`

  * The following instances have been added to `Lift`:

      - `Int#`, `Word#`, `Float#`, `Double#`, `Char#`, `Addr#`
      - unboxed tuples of lifted types up to arity 7
      - unboxed sums of lifted types up to arity 7

    Ideally we would have levity-polymorphic _instances_ of unboxed
    tuples and sums.

  * The code generated by `-XDeriveLift` uses expression quotes
    instead of generating large amounts of TH code and having
    special hard-coded cases for some unboxed types.
15 files changed:
compiler/prelude/THNames.hs
compiler/typecheck/Inst.hs
compiler/typecheck/TcDeriv.hs
compiler/typecheck/TcDerivUtils.hs
compiler/typecheck/TcExpr.hs
compiler/typecheck/TcGenDeriv.hs
compiler/typecheck/TcSplice.hs
docs/users_guide/8.10.1-notes.rst
docs/users_guide/glasgow_exts.rst
libraries/template-haskell/Language/Haskell/TH/Syntax.hs
libraries/template-haskell/changelog.md
libraries/template-haskell/template-haskell.cabal.in
testsuite/tests/deriving/should_compile/T14682.stderr
testsuite/tests/deriving/should_compile/drv-empty-data.stderr
testsuite/tests/quotes/TH_localname.stderr