77
88module Control.Monad.Eff.Ref where
99
10- import Control.Monad.Eff
10+ import Control.Monad.Eff ( Eff ())
1111
1212-- | The effect associated with the use of global mutable variables.
1313foreign import data REF :: !
@@ -17,26 +17,29 @@ foreign import data REF :: !
1717foreign import data Ref :: * -> *
1818
1919-- | Create a new mutable reference containing the specified value.
20- foreign import newRef " " "
20+ foreign import newRef
21+ " " "
2122 function newRef(val) {
2223 return function () {
2324 return { value: val };
2425 };
2526 }
26- " " " :: forall s r . s -> Eff (ref :: REF | r ) (Ref s )
27+ " " " :: forall s r . s -> Eff (ref :: REF | r ) (Ref s )
2728
2829-- | Read the current value of a mutable reference
29- foreign import readRef " " "
30+ foreign import readRef
31+ " " "
3032 function readRef(ref) {
3133 return function() {
3234 return ref.value;
3335 };
3436 }
35- " " " :: forall s r . Ref s -> Eff (ref :: REF | r ) s
37+ " " " :: forall s r . Ref s -> Eff (ref :: REF | r ) s
3638
3739-- | Update the value of a mutable reference by applying a function
3840-- | to the current value.
39- foreign import modifyRef' " " "
41+ foreign import modifyRef'
42+ " " "
4043 function modifyRef$prime(ref) {
4144 return function(f) {
4245 return function() {
@@ -46,15 +49,16 @@ foreign import modifyRef' """
4649 };
4750 };
4851 }
49- " " " :: forall s b r . Ref s -> (s -> { state :: s , value :: b } ) -> Eff (ref :: REF | r ) b
52+ " " " :: forall s b r . Ref s -> (s -> { state :: s , value :: b } ) -> Eff (ref :: REF | r ) b
5053
5154-- | Update the value of a mutable reference by applying a function
5255-- | to the current value.
5356modifyRef :: forall s r . Ref s -> (s -> s ) -> Eff (ref :: REF | r ) Unit
5457modifyRef ref f = modifyRef' ref (\s -> { state: f s, value: unit })
5558
5659-- | Update the value of a mutable reference to the specified value.
57- foreign import writeRef " " "
60+ foreign import writeRef
61+ " " "
5862 function writeRef(ref) {
5963 return function(val) {
6064 return function() {
@@ -63,4 +67,4 @@ foreign import writeRef """
6367 };
6468 };
6569 }
66- " " " :: forall s r . Ref s -> s -> Eff (ref :: REF | r ) Unit
70+ " " " :: forall s r . Ref s -> s -> Eff (ref :: REF | r ) Unit
0 commit comments