This library provides extensive DOM and web bindings for writing Idris2 programs that run in the browser.
This project comes "batteries included" with an additional library for interop with unsafe world of JavaScript.
The sources in src/Web/Raw
and src/Web/Internal
have been generated automatically using
the idris2-webidl
package, but some additional functions have been (and will be) added
manually, either for an increase in type safety or convenience or both.
A tutorial with a working example program and detailed explanations about how the different pieces in this library fit together can be found here.
Quite a bit of functionality is still missing when it comes
to external types like Array
or Promise
, but will be added
later on.
The DOM bindings as well as the JavaScript utilities can be built
by running idris2 --build dom.ipkg
. Given the size of the codebase,
this might take several minutes.
These have been moved to a separate library in the js
directory.
The tutorial consists of one or more literal Idris2 files to be
found at srd/Doc
. It can be built by running idris2 --build doc.ipkg
and tested afterwards by loading doc.html
in one's favorite browser.
There is js/test/test.ipkg
for running several Hedgehog property tests.
This should be built and run with node, as it mainly tests the
JavaScript utilities working on both JavaScript backends.
Packages dom.ipkg
, doc.ipkg
and js.ipkg
depend on the following packages:
The test package test.ipkg
depends on the same libraries plus
the following:
It is recommended to use pack for building, testing, and installing the libraries provided here.