Skip to content

Instantly share code, notes, and snippets.

@pasberth
Last active December 22, 2015 01:38
Show Gist options
  • Save pasberth/6397526 to your computer and use it in GitHub Desktop.
Save pasberth/6397526 to your computer and use it in GitHub Desktop.
Idris で hello world

(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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment