[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 7 commits: Allow generation of TTH syntax with TH

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Thu Apr 13 07:40:28 UTC 2023



Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
ebd8918b by Oleg Grenrus at 2023-04-12T12:32:57-04:00
Allow generation of TTH syntax with TH

In other words allow generation of typed splices and brackets with
Untyped Template Haskell.

That is useful in cases where a library is build with TTH in mind,
but we still want to generate some auxiliary declarations,
where TTH cannot help us, but untyped TH can.
Such example is e.g. `staged-sop` which works with TTH,
but we would like to derive `Generic` declarations with TH.

An alternative approach is to use `unsafeCodeCoerce`, but then the
derived `Generic` instances would be type-checked only at use sites,
i.e. much later. Also `-ddump-splices` output is quite ugly:
user-written instances would use TTH brackets, not `unsafeCodeCoerce`.

This commit doesn't allow generating of untyped template splices
and brackets with untyped TH, as I don't know why one would want to do
that (instead of merging the splices, e.g.)

- - - - -
690d0225 by Rodrigo Mesquita at 2023-04-12T12:33:33-04:00
Add regression test for #23229

- - - - -
8c6d6f62 by Sylvain Henry at 2023-04-13T03:40:23-04:00
Add quotRem rules (#22152)

  case quotRemInt# x y of
     (# q, _ #) -> body
  ====>
   case quotInt# x y of
     q -> body

  case quotRemInt# x y of
     (# _, r #) -> body
  ====>
   case remInt# x y of
     r -> body

- - - - -
bad1b375 by Sylvain Henry at 2023-04-13T03:40:23-04:00
Add quot folding rule (#22152)

   (x / l1) / l2
   l1 and l2 /= 0
   l1*l2 doesn't overflow
   ==> x / (l1 * l2)

- - - - -
33e17249 by Sylvain Henry at 2023-04-13T03:40:23-04:00
Make Int64/Word64 division ok for speculation too.

Only when the divisor is definitely non-zero.

- - - - -
6b302610 by Sylvain Henry at 2023-04-13T03:40:23-04:00
Make WordQuotRem2Op ok-for-speculation too

- - - - -
f435268d by Josh Meredith at 2023-04-13T03:40:24-04:00
Base/JS: GHC.JS.Foreign.Callback module (issue 23126)

* Add the Callback module for "exporting" Haskell functions
to be available to plain JavaScript code

* Fix some primitives defined in GHC.JS.Prim

* Add a JavaScript section to the user guide with instructions
on how to use the JavaScript FFI, building up to using Callbacks
to interact with the browser

* Add tests for the JavaScript FFI and Callbacks

- - - - -


30 changed files:

- compiler/GHC/Builtin/PrimOps.hs
- compiler/GHC/Core/Opt/ConstantFold.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/ThToHs.hs
- compiler/GHC/Types/Literal.hs
- docs/users_guide/index.rst
- + docs/users_guide/javascript.rst
- + libraries/base/GHC/JS/Foreign/Callback.hs
- libraries/base/GHC/JS/Prim.hs
- libraries/base/base.cabal
- libraries/template-haskell/Language/Haskell/TH/Lib.hs
- libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs
- libraries/template-haskell/Language/Haskell/TH/Ppr.hs
- libraries/template-haskell/Language/Haskell/TH/Syntax.hs
- libraries/template-haskell/changelog.md
- + testsuite/tests/ghci/should_run/T23229.hs
- + testsuite/tests/ghci/should_run/T23229.script
- testsuite/tests/ghci/should_run/all.T
- testsuite/tests/javascript/all.T
- + testsuite/tests/javascript/js-callback01.hs
- + testsuite/tests/javascript/js-callback01.stdout
- + testsuite/tests/javascript/js-callback02.hs
- + testsuite/tests/javascript/js-callback02.stdout
- + testsuite/tests/javascript/js-callback03.hs
- + testsuite/tests/javascript/js-callback03.stdout
- + testsuite/tests/javascript/js-callback04.hs
- + testsuite/tests/javascript/js-callback04.stdout
- + testsuite/tests/javascript/js-callback05.hs
- + testsuite/tests/javascript/js-callback05.stdout


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/006cd8bd7d0f37f8eb281d52e41f21ea7c678502...f435268da08a9f6f4c0ec7581755ff48f9044327

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/006cd8bd7d0f37f8eb281d52e41f21ea7c678502...f435268da08a9f6f4c0ec7581755ff48f9044327
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230413/d4feaa80/attachment.html>


More information about the ghc-commits mailing list