0.0.4 • Published 10 years ago

gulp-haste v0.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

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
0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago