This library provides extensive DOM and web bindings for writing Idris2 programs that run in the browser.
This library comes "batteries included", as quite a few utility types
and functions for interacting with the unsafe world of Javascript
are provided via the JS
submodules. These might eventually be moved
to their own repository, but as Idris2 is still lacking an official
package repository, it makes sense to keep this stuff in one package
for the time being.
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.
The functionality provided by the submodules of JS
should eventually
go to its own repository. As a preparation for this change and to
speed up development of Javascript utilities (typechecking dom.ipkg
is slow), package file js.ipkg
is provided.
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 also test.ipkg
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:
This libary is still evolving - as is Idris2 itself - and I try to keep up with the latest Idris2 commits. The actual release requires Idris2, version 0.4.0. The latest commit has been built against Idris 2, version 0.4.0-ea1ad1688.