Package

purescript-p5

Repository
parenparen/purescript-p5
License
MIT
Uploaded by
parenparen
Published on
2019-01-11T05:45:03Z

p5.js bindings for PureScript

Disclaimer: This project has just been started and the API is still very unstable.

There are still a large percentage of p5.js functions that have not yet been implemented (see unsupported.md).

Installation

This library depends on p5.js. This dependency may be satisfied by installing the NPM p5.js package.

npm install p5 --save

Running the examples

The examples use the webpack DLLPlugin to improve build performance. To run the examples, first build the dll bundle with:

npm run webpack:dll

This creates a separate webpack bundle for dependencies so that they don't need to be regenerated each time the app is changed.

To start webpack dev server, run:

npm run webpack:server

With webpack dev server running, examples can be viewed in a browser by visiting localhost:4008/examples/path-to-example.

Project Status

Most of the FFI as been auto-generated from the p5.js YUIDoc. There are still a large number of functions that couldn't be auto-generated, sometimes because of missing type information in the YUIDoc (see unsupported.md). These might have to be written by hand.

Completed:

  • generate FFI PureScript functions for p5.js functions of basic types (e.g. Number, String, Boolean), p5.Vector, p5.Color, array types, optional types, p5 constants, and product types (e.g. Number|String)

TODO:

  • export easier-to-use interface to hide complicated signatures in generated interface
  • generate FFI for remaining unimplemented p5.js types
  • support functions with greater than 10 arguments (the library uses runFn, which is only defined for functions of at most 10 arguments)
  • generate comments for FFI functions so that purescript-p5 documentation can be auto-generated by pulp

References

Many of the examples are based on the p5.js examples on the p5.js reference site, and are licensed under CC BY-NC-SA 4.0.