diff --git a/bower.json b/bower.json index 02fcb61..9901e02 100644 --- a/bower.json +++ b/bower.json @@ -5,7 +5,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 deleted file mode 100644 index af32693..0000000 --- a/src/Control/Monad/Eff.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; - -// module Control.Monad.Eff - -exports.pureE = 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])(); - } - }; - }; -}; diff --git a/src/Control/Monad/Eff.lua b/src/Control/Monad/Eff.lua new file mode 100644 index 0000000..fffa387 --- /dev/null +++ b/src/Control/Monad/Eff.lua @@ -0,0 +1,63 @@ +-- module Control.Monad.Eff + +local Control_Monad_Eff = {} + +Control_Monad_Eff.pureE = 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 deleted file mode 100644 index b24421f..0000000 --- a/src/Control/Monad/Eff/Unsafe.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -// module Control.Monad.Eff.Unsafe - -exports.unsafeInterleaveEff = function (f) { - return f; -}; diff --git a/src/Control/Monad/Eff/Unsafe.lua b/src/Control/Monad/Eff/Unsafe.lua new file mode 100644 index 0000000..a80ac2b --- /dev/null +++ b/src/Control/Monad/Eff/Unsafe.lua @@ -0,0 +1,8 @@ +-- module Control.Monad.Eff.Unsafe +local Control_Monad_Eff_Unsafe = {} + +Control_Monad_Eff_Unsafe.unsafeInterleaveEff = function (f) + return f +end + +return Control_Monad_Eff_Unsafe