Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Effect/Ref.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports.read = function (ref) {
};
};

exports["modify'"] = function (f) {
exports.modifyImpl = function (f) {
return function (ref) {
return function () {
var t = f(ref.value);
Expand Down
15 changes: 13 additions & 2 deletions src/Effect/Ref.purs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
-- |
-- | _Note_: `Control.Monad.ST` provides a _safe_ alternative to `Ref` when
-- | mutation is restricted to a local scope.
module Effect.Ref where
module Effect.Ref
( Ref
, new
, read
, modify'
, modify
, modify_
, write
) where

import Prelude

Expand All @@ -20,7 +28,10 @@ foreign import read :: forall s. Ref s -> Effect s

-- | Update the value of a mutable reference by applying a function
-- | to the current value.
foreign import modify' :: forall s b. (s -> { state :: s, value :: b }) -> Ref s -> Effect b
modify' :: forall s b. (s -> { state :: s, value :: b }) -> Ref s -> Effect b
modify' = modifyImpl

foreign import modifyImpl :: forall s b. (s -> { state :: s, value :: b }) -> Ref s -> Effect b

-- | Update the value of a mutable reference by applying a function
-- | to the current value. The updated value is returned.
Expand Down