Skip to content

Commit f3a18ab

Browse files
committed
Updates for 0.12
1 parent 6781dbf commit f3a18ab

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
"package.json"
1818
],
1919
"dependencies": {
20-
"purescript-effect": "^0.1.0"
20+
"purescript-effect": "#compiler/0.12"
2121
}
2222
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
"use strict";
22

3-
exports.newRef = function (val) {
3+
exports.new = function (val) {
44
return function () {
55
return { value: val };
66
};
77
};
88

9-
exports.readRef = function (ref) {
9+
exports.read = function (ref) {
1010
return function () {
1111
return ref.value;
1212
};
1313
};
1414

15-
exports["modifyRef'"] = function (ref) {
16-
return function (f) {
15+
exports["modify'"] = function (f) {
16+
return function (ref) {
1717
return function () {
1818
var t = f(ref.value);
1919
ref.value = t.state;
@@ -22,8 +22,8 @@ exports["modifyRef'"] = function (ref) {
2222
};
2323
};
2424

25-
exports.writeRef = function (ref) {
26-
return function (val) {
25+
exports.write = function (val) {
26+
return function (ref) {
2727
return function () {
2828
ref.value = val;
2929
return {};
Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
-- | This module defines an effect and actions for working with
22
-- | global mutable variables.
33
-- |
4-
-- | _Note_: The `Control.Monad.ST` provides a _safe_ alternative
4+
-- | _Note_: `Control.Monad.ST` provides a _safe_ alternative
55
-- | to global mutable variables when mutation is restricted to a
66
-- | local scope.
7-
module Control.Monad.Effect.Ref where
7+
module Effect.Ref where
88

9-
import Control.Monad.Effect (Effect)
10-
import Prelude (Unit, unit)
9+
import Prelude
10+
11+
import Effect (Effect)
1112

1213
-- | A value of type `Ref a` represents a mutable reference
1314
-- | which holds a value of type `a`.
1415
foreign import data Ref :: Type -> Type
1516

1617
-- | Create a new mutable reference containing the specified value.
17-
foreign import newRef :: forall s. s -> Effect (Ref s)
18+
foreign import new :: forall s. s -> Effect (Ref s)
1819

1920
-- | Read the current value of a mutable reference
20-
foreign import readRef :: forall s. Ref s -> Effect s
21+
foreign import read :: forall s. Ref s -> Effect s
2122

2223
-- | Update the value of a mutable reference by applying a function
2324
-- | to the current value.
24-
foreign import modifyRef' :: forall s b. Ref s -> (s -> { state :: s, value :: b }) -> Effect b
25+
foreign import modify' :: forall s b. (s -> { state :: s, value :: b }) -> Ref s -> Effect b
2526

2627
-- | Update the value of a mutable reference by applying a function
2728
-- | to the current value.
28-
modifyRef :: forall s. Ref s -> (s -> s) -> Effect Unit
29-
modifyRef ref f = modifyRef' ref (\s -> { state: f s, value: unit })
29+
modify :: forall s. (s -> s) -> Ref s -> Effect Unit
30+
modify f = modify' (\s -> { state: f s, value: unit })
3031

3132
-- | Update the value of a mutable reference to the specified value.
32-
foreign import writeRef :: forall s. Ref s -> s -> Effect Unit
33+
foreign import write :: forall s. s -> Ref s -> Effect Unit

0 commit comments

Comments
 (0)