From b22b3dc6e20afdaedef16650ea11218d14aa39db Mon Sep 17 00:00:00 2001 From: Xandaros Date: Fri, 4 Mar 2016 16:46:08 +0100 Subject: [PATCH 1/2] Convert to Lua --- bower.json | 2 +- src/Control/Monad/Eff.js | 125 ++++++++++++++++---------------- src/Control/Monad/Eff/Unsafe.js | 12 +-- 3 files changed, 70 insertions(+), 69 deletions(-) diff --git a/bower.json b/bower.json index 27b9577..00f365b 100644 --- a/bower.json +++ b/bower.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "git://github.com/purescript/purescript-eff.git" + "url": "git://github.com/lua-purescript/purescript-eff.git" }, "ignore": [ "**/.*", diff --git a/src/Control/Monad/Eff.js b/src/Control/Monad/Eff.js index 1498f21..c691adc 100644 --- a/src/Control/Monad/Eff.js +++ b/src/Control/Monad/Eff.js @@ -1,62 +1,63 @@ -/* global exports */ -"use strict"; - -// module Control.Monad.Eff - -exports.returnE = function (a) { - return function () { - return a; - }; -}; - -exports.bindE = function (a) { - return function (f) { - return function () { - return f(a())(); - }; - }; -}; - -exports.runPure = function (f) { - return f(); -}; - -exports.untilE = function (f) { - return function () { - while (!f()); - return {}; - }; -}; - -exports.whileE = function (f) { - return function (a) { - return function () { - while (f()) { - a(); - } - return {}; - }; - }; -}; - -exports.forE = function (lo) { - return function (hi) { - return function (f) { - return function () { - for (var i = lo; i < hi; i++) { - f(i)(); - } - }; - }; - }; -}; - -exports.foreachE = function (as) { - return function (f) { - return function () { - for (var i = 0, l = as.length; i < l; i++) { - f(as[i])(); - } - }; - }; -}; +-- module Control.Monad.Eff + +local Control_Monad_Eff = {} + +Control_Monad_Eff.returnE = function (a) + return function () + return a + end +end + +Control_Monad_Eff.bindE = function (a) + return function (f) + return function () + return f(a())() + end + end +end + +Control_Monad_Eff.runPure = function (f) + return f() +end + +Control_Monad_Eff.untilE = function (f) + return function () + while not f() do end + return {} + end +end + +Control_Monad_Eff.whileE = function (f) + return function (a) + return function () + while f() do + a() + end + return {} + end + end +end + +Control_Monad_Eff.forE = function (lo) + return function (hi) + return function (f) + return function () + for i = lo, hi do + f(i)() + end + end + end + end +end + +Control_Monad_Eff.foreachE = function (as) + return function (f) + return function () + for i = 0, #as do + f(as[i])() + end + end + end +end + +return Control_Monad_Eff diff --git a/src/Control/Monad/Eff/Unsafe.js b/src/Control/Monad/Eff/Unsafe.js index bada18a..a80ac2b 100644 --- a/src/Control/Monad/Eff/Unsafe.js +++ b/src/Control/Monad/Eff/Unsafe.js @@ -1,8 +1,8 @@ -/* global exports */ -"use strict"; +-- module Control.Monad.Eff.Unsafe +local Control_Monad_Eff_Unsafe = {} -// module Control.Monad.Eff.Unsafe +Control_Monad_Eff_Unsafe.unsafeInterleaveEff = function (f) + return f +end -exports.unsafeInterleaveEff = function (f) { - return f; -}; +return Control_Monad_Eff_Unsafe From 460603fec4b779e1516d30b90b75524cc73ab306 Mon Sep 17 00:00:00 2001 From: Martin Zeller Date: Sat, 5 Mar 2016 17:35:53 +0100 Subject: [PATCH 2/2] Rename *.js files to *.lua --- src/Control/Monad/{Eff.js => Eff.lua} | 0 src/Control/Monad/Eff/{Unsafe.js => Unsafe.lua} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src/Control/Monad/{Eff.js => Eff.lua} (100%) rename src/Control/Monad/Eff/{Unsafe.js => Unsafe.lua} (100%) diff --git a/src/Control/Monad/Eff.js b/src/Control/Monad/Eff.lua similarity index 100% rename from src/Control/Monad/Eff.js rename to src/Control/Monad/Eff.lua diff --git a/src/Control/Monad/Eff/Unsafe.js b/src/Control/Monad/Eff/Unsafe.lua similarity index 100% rename from src/Control/Monad/Eff/Unsafe.js rename to src/Control/Monad/Eff/Unsafe.lua