diff --git a/bower.json b/bower.json index a4b8090..9a99580 100644 --- a/bower.json +++ b/bower.json @@ -17,6 +17,6 @@ "package.json" ], "dependencies": { - "purescript-eff": "^3.0.0" + "purescript-effect": "^0.1.0" } } diff --git a/src/Control/Monad/Eff/Ref/Unsafe.purs b/src/Control/Monad/Eff/Ref/Unsafe.purs deleted file mode 100644 index fec0c3d..0000000 --- a/src/Control/Monad/Eff/Ref/Unsafe.purs +++ /dev/null @@ -1,16 +0,0 @@ --- | Unsafe functions for working with mutable references. - -module Control.Monad.Eff.Ref.Unsafe where - -import Control.Monad.Eff (Eff) -import Control.Monad.Eff.Ref (REF) -import Control.Monad.Eff.Unsafe (unsafeCoerceEff) - --- | This handler function unsafely removes the `Ref` effect from an --- | effectful action. --- | --- | This function might be used when it is impossible to prove to the --- | typechecker that a particular mutable reference does not escape --- | its scope. -unsafeRunRef :: forall eff a. Eff (ref :: REF | eff) a -> Eff eff a -unsafeRunRef = unsafeCoerceEff diff --git a/src/Control/Monad/Eff/Ref.js b/src/Control/Monad/Effect/Ref.js similarity index 100% rename from src/Control/Monad/Eff/Ref.js rename to src/Control/Monad/Effect/Ref.js diff --git a/src/Control/Monad/Eff/Ref.purs b/src/Control/Monad/Effect/Ref.purs similarity index 59% rename from src/Control/Monad/Eff/Ref.purs rename to src/Control/Monad/Effect/Ref.purs index 09a4ae6..677a080 100644 --- a/src/Control/Monad/Eff/Ref.purs +++ b/src/Control/Monad/Effect/Ref.purs @@ -4,32 +4,29 @@ -- | _Note_: The `Control.Monad.ST` provides a _safe_ alternative -- | to global mutable variables when mutation is restricted to a -- | local scope. -module Control.Monad.Eff.Ref where +module Control.Monad.Effect.Ref where +import Control.Monad.Effect (Effect) import Prelude (Unit, unit) -import Control.Monad.Eff (Eff, kind Effect) - --- | The effect associated with the use of global mutable variables. -foreign import data REF :: Effect -- | A value of type `Ref a` represents a mutable reference -- | which holds a value of type `a`. foreign import data Ref :: Type -> Type -- | Create a new mutable reference containing the specified value. -foreign import newRef :: forall s r. s -> Eff (ref :: REF | r) (Ref s) +foreign import newRef :: forall s. s -> Effect (Ref s) -- | Read the current value of a mutable reference -foreign import readRef :: forall s r. Ref s -> Eff (ref :: REF | r) s +foreign import readRef :: forall s. Ref s -> Effect s -- | Update the value of a mutable reference by applying a function -- | to the current value. -foreign import modifyRef' :: forall s b r. Ref s -> (s -> { state :: s, value :: b }) -> Eff (ref :: REF | r) b +foreign import modifyRef' :: forall s b. Ref s -> (s -> { state :: s, value :: b }) -> Effect b -- | Update the value of a mutable reference by applying a function -- | to the current value. -modifyRef :: forall s r. Ref s -> (s -> s) -> Eff (ref :: REF | r) Unit +modifyRef :: forall s. Ref s -> (s -> s) -> Effect Unit modifyRef ref f = modifyRef' ref (\s -> { state: f s, value: unit }) -- | Update the value of a mutable reference to the specified value. -foreign import writeRef :: forall s r. Ref s -> s -> Eff (ref :: REF | r) Unit +foreign import writeRef :: forall s. Ref s -> s -> Effect Unit