Created
September 29, 2014 20:05
-
-
Save nebuta/8eacbe2550aec1c8e7bc to your computer and use it in GitHub Desktop.
JavaScript generated by PureScript compiler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var PS = PS || {}; | |
PS.Prelude = (function () { | |
"use strict"; | |
function Show(show) { | |
this.show = show; | |
}; | |
function Num($percent, $times, $plus, $minus, $div, negate) { | |
this["%"] = $percent; | |
this["*"] = $times; | |
this["+"] = $plus; | |
this["-"] = $minus; | |
this["/"] = $div; | |
this.negate = negate; | |
}; | |
function showNumberImpl(n) { return n.toString();}; | |
function numAdd(n1) { return function(n2) { return n1 + n2; };}; | |
function numSub(n1) { return function(n2) { return n1 - n2; };}; | |
function numMul(n1) { return function(n2) { return n1 * n2; };}; | |
function numDiv(n1) { return function(n2) { return n1 / n2; };}; | |
function numMod(n1) { return function(n2) { return n1 % n2; };}; | |
function numNegate(n) { return -n;}; | |
var $times = function (dict) { | |
return dict["*"]; | |
}; | |
var $dollar = function (f) { | |
return function (x) { | |
return f(x); | |
}; | |
}; | |
var showNumber = function () { | |
return new Show(showNumberImpl); | |
}; | |
var show = function (dict) { | |
return dict.show; | |
}; | |
var numNumber = function () { | |
return new Num(numMod, numMul, numAdd, numSub, numDiv, numNegate); | |
}; | |
return { | |
Num: Num, | |
Show: Show, | |
"*": $times, | |
show: show, | |
"$": $dollar, | |
showNumber: showNumber, | |
numNumber: numNumber | |
}; | |
})(); | |
var PS = PS || {}; | |
PS.Debug_Trace = (function () { | |
"use strict"; | |
var Prelude = PS.Prelude; | |
function trace(s) { return function() { console.log(s); return {}; };}; | |
return { | |
trace: trace | |
}; | |
})(); | |
var PS = PS || {}; | |
PS.Test = (function () { | |
"use strict"; | |
var Prelude = PS.Prelude; | |
var Debug_Trace = PS.Debug_Trace; | |
var square = function (x) { | |
return x * x; | |
}; | |
var main = Debug_Trace.trace(Prelude.show(Prelude.showNumber())(square(3))); | |
return { | |
main: main, | |
square: square | |
}; | |
})(); | |
PS.Test.main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment