ghcjs-commonjs/examples
2016-06-23 02:24:54 -03:00
..
failure Example fixes 2016-06-23 02:24:54 -03:00
fibonacci Example fixes 2016-06-23 02:24:54 -03:00
hello-variable-name Example fixes 2016-06-23 02:24:54 -03:00
hello-world Example fixes 2016-06-23 02:24:54 -03:00
pandoc Example fixes 2016-06-23 02:24:54 -03:00
webpack Example fixes 2016-06-23 02:24:54 -03:00
Makefile Get hello world to working state 2016-06-18 12:38:10 -03:00
README.md Update examples README 2016-06-22 17:38:34 -03:00

ghcjs-commonjs-examples

This is a collection of runnable examples for ghcjs-commonjs.

hello-world Getting Started

Take a look at the hello-world example to start. It shows off how to call Haskell functions from JavaScript and run code after it has finished.

hello-variable-name Passing arguments to functions

hello-variable-name shows off how to pass arguments from JavaScript onto Haskell functions. Anything that may be converted from a JavaScript value onto a Haskell value will be automatically converted for you.

fibonacci Passing arguments and yielding return values

fibonacci shows off how to pass arguments and get something back from/to Haskell/JavaScript. It shows that we may wrap pure and unpure computations

failure Handling errors from Haskell in JavaScript

failure shows that any errors thrown from the Haskell world will result in the Promise being rejected.

webpack Basic Haskell webpack build system integration

webpack shows off how to require('Stuff.hs') from JavaScript using webpack this integration is still primitive but easy to improve.

pandoc Exposing existing Haskell packages

pandoc exports a basic JavaScript API, which let's JavaScript users run PanDoc natively. It works on Node.js and the browser, through node-main.js and webpack, but webpack takes 1 hour and many gigabytes of RAM to compile...