[Git][ghc/ghc][wip/js-mkdir] 11 commits: Allow generation of TTH syntax with TH

Josh Meredith (@JoshMeredith) gitlab at gitlab.haskell.org
Fri Apr 14 08:58:17 UTC 2023



Josh Meredith pushed to branch wip/js-mkdir 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

- - - - -
59321879 by Sylvain Henry at 2023-04-13T08:50:33-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

- - - - -
4dd02122 by Sylvain Henry at 2023-04-13T08:50:33-04:00
Add quot folding rule (#22152)

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

- - - - -
1148ac72 by Sylvain Henry at 2023-04-13T08:50:33-04:00
Make Int64/Word64 division ok for speculation too.

Only when the divisor is definitely non-zero.

- - - - -
8af401cc by Sylvain Henry at 2023-04-13T08:50:33-04:00
Make WordQuotRem2Op ok-for-speculation too

- - - - -
27d2978e by Josh Meredith at 2023-04-13T08:51:09-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

- - - - -
a34aa8da by Adam Sandberg Ericsson at 2023-04-14T04:17:52-04:00
rts: improve memory ordering and add some comments in the StablePtr implementation

- - - - -
d7a768a4 by Matthew Pickering at 2023-04-14T04:18:28-04:00
docs: Generate docs/index.html with version number

* Generate docs/index.html to include the version of the ghc library

* This also fixes the packageVersions interpolations which were
  - Missing an interpolation for `LIBRARY_ghc_VERSION`
  - Double quoting the version so that "9.7" was being inserted.

Fixes #23121

- - - - -
d48fbfea by Simon Peyton Jones at 2023-04-14T04:19:05-04:00
Stop if type constructors have kind errors

Otherwise we get knock-on errors, such as #23252.

This makes GHC fail a bit sooner, and I have not attempted to add
recovery code, to add a fake TyCon place of the erroneous one,
in an attempt to get more type errors in one pass.  We could
do that (perhaps) if there was a call for it.

- - - - -
82a69424 by Josh Meredith at 2023-04-14T08:57:55+00:00
JS/base: provide implementation for mkdir (issue 22374)

- - - - -


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/Tc/TyCl.hs
- compiler/GHC/ThToHs.hs
- compiler/GHC/Types/Literal.hs
- docs/index.html → docs/index.html.in
- docs/users_guide/index.rst
- + docs/users_guide/javascript.rst
- hadrian/src/Rules/Documentation.hs
- hadrian/src/Rules/Generate.hs
- + libraries/base/GHC/JS/Foreign/Callback.hs
- libraries/base/GHC/JS/Prim.hs
- libraries/base/base.cabal
- libraries/base/jsbits/base.js
- libraries/base/tests/IO/all.T
- 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
- rts/StablePtr.c
- testsuite/tests/dependent/should_fail/T15743c.hs
- testsuite/tests/dependent/should_fail/T15743c.stderr
- testsuite/tests/ghc-api/target-contents/all.T
- + 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


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f8926212a519458f16122aee72b53223169e65f3...82a694245439e3d463c0ea84402b711472daab63

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f8926212a519458f16122aee72b53223169e65f3...82a694245439e3d463c0ea84402b711472daab63
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/20230414/ed021471/attachment.html>


More information about the ghc-commits mailing list