Skip to content
This repository was archived by the owner on Aug 10, 2020. It is now read-only.
yawaraminPublic archive

About

(WIP) BuckleScript Web API Bindings

Resources

Stars

11 stars

Watchers

1 watching

Forks

Latest commit

 

History

54 Commits

Folders and files

Repository files navigation

(WIP) BuckleScript Web API Bindings

The JavaScript Web APIs are notoriously object-oriented, making them tricky to model using simple functional data types.

This package of bindings takes advantage of the fact that OCaml's polymorphic variant types obey the laws of subtyping ([< ...] means supertype and [> ...] means subtype) to use them as phantom type tags, for a type which represents the entire Web API inheritance tree starting from EventTarget.

Right now, this package is just a proof-of-concept; if it proves to scale, I will cover more and more of the Web API surface area, as time allows. PRs welcome!

API Documentation

See https://yawaramin.github.io/bs-webapi

Build

First, ensure you have bs-platform installed globally:

npm i -g bs-platform

Then, link it into this project:

npm link bs-platform

Then, build:

npm run build

Watch

npm run watch

Build Docs

You will need ocamldoc installed globally, and also need to run the build (as above) at least once. Also, you'll need to run this inside bash. Then:

npm run docs

Will put the API documentation in the docs subdirectory.

If you're not on a Mac or have bs-platform in a non-standard location, you'll need to adjust the path to bsppx.exe (which processes BuckleScript bindings so that the right types get sent to ocamldoc).

About

(WIP) BuckleScript Web API Bindings

Resources

Stars

11 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages