idris2-dom
idris2-dom copied to clipboard
Javascript DOM bindings for Idris2
idris2-dom: Extensive DOM and Web Bindings for Idris2
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.
Project structure
DOM
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.
JavaScript utilities
These have been moved to a separate library in the js
directory.
Documentation
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.
Tests
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.
Dependencies
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:
Misc
It is recommended to use pack for building, testing, and installing the libraries provided here.