gulp-haste

0.0.4 • Public • Published

Why

This gulp plugin allows to use the Haste compiler to produce Requirejs modules from Haskell programs. You can export only one function at the moment.

Prerequisites

Installation

npm install gulp-haste

Configuration

 
haste = require('gulp-haste');
 
gulp.src("*.hs")
    .pipe(haste(options))
    .pipe(gulp.dest("build"));

where options is an optional hash. If you omit options, the Haskell's function exported is just main.

Options

var options = {
   export: true;
   withJs: "file.js"
}
  • export=true specifies that the whole set of FFI exported functions should be made available when requiring the module;
  • withJs includes the specified file in the prologue of the compiled program.

Example

The code below FFI exports one function, which will be available by requiring the module:

import Haste.Foreign
 
myFunction:: Int -> IO Bool
myFunction _ = return True
 
main = do 
    export "name_of_haskell_function" myFunction 

In order to load this function javascript-side:

myHaskellFunction = require('converted_by_hastec').name_of_haskell_function

Readme

Keywords

Package Sidebar

Install

npm i gulp-haste

Weekly Downloads

3

Version

0.0.4

License

MIT

Last publish

Collaborators

  • vzaccaria