From 722892fffb78bc5d2d3b51642d6e951d8afda725 Mon Sep 17 00:00:00 2001 From: Martin Zeller Date: Sat, 5 Mar 2016 21:52:31 +0100 Subject: [PATCH] Convert to Lua --- bower.json | 2 +- src/Control/Monad/ST.js | 38 -------------------------------------- src/Control/Monad/ST.lua | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 39 deletions(-) delete mode 100644 src/Control/Monad/ST.js create mode 100644 src/Control/Monad/ST.lua diff --git a/bower.json b/bower.json index 9352215..ccd6355 100644 --- a/bower.json +++ b/bower.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "git://github.com/purescript/purescript-st.git" + "url": "git://github.com/lua-purescript/purescript-st.git" }, "ignore": [ "**/.*", diff --git a/src/Control/Monad/ST.js b/src/Control/Monad/ST.js deleted file mode 100644 index 64597c1..0000000 --- a/src/Control/Monad/ST.js +++ /dev/null @@ -1,38 +0,0 @@ -/* global exports */ -"use strict"; - -// module Control.Monad.ST - -exports.newSTRef = function (val) { - return function () { - return { value: val }; - }; -}; - -exports.readSTRef = function (ref) { - return function () { - return ref.value; - }; -}; - -exports.modifySTRef = function (ref) { - return function (f) { - return function () { - /* jshint boss: true */ - return ref.value = f(ref.value); - }; - }; -}; - -exports.writeSTRef = function (ref) { - return function (a) { - return function () { - /* jshint boss: true */ - return ref.value = a; - }; - }; -}; - -exports.runST = function (f) { - return f; -}; diff --git a/src/Control/Monad/ST.lua b/src/Control/Monad/ST.lua new file mode 100644 index 0000000..fec4b75 --- /dev/null +++ b/src/Control/Monad/ST.lua @@ -0,0 +1,38 @@ +-- module Control.Monad.ST +local ST = {} + +ST.newSTRef = function (val) + return function () + return { value = val } + end +end + +ST.readSTRef = function (ref) + return function () + return ref.value + end +end + +ST.modifySTRef = function (ref) + return function (f) + return function () + ref.value = f(ref.value) + return ref.value + end + end +end + +ST.writeSTRef = function (ref) + return function (a) + return function () + ref.value = a + return ref.value + end + end +end + +ST.runST = function (f) + return f +end + +return ST