(Idris version 0.9.7) でテストされています
$ idris a.idr --target javascript -o hello.js
$ node hello.js
hello world
module Main | |
require : String -> IO () | |
require x = mkForeign (FFun ("(function (x) { __IDR__.Ext = require(x); })") [FString] FUnit) x | |
say : String -> IO () | |
say x = mkForeign (FFun "__IDR__.Ext.say" [FString] FUnit) x | |
main : IO () | |
main = do | |
require "./say" | |
say "hello world" |
function say (msg) { | |
console.log(msg); | |
} | |
module.exports = { | |
say : say | |
} |