diff --git a/bower.json b/bower.json index 7f5e81e..78cd836 100644 --- a/bower.json +++ b/bower.json @@ -15,11 +15,11 @@ "package.json" ], "dependencies": { - "purescript-aff": "^4.0.2", - "purescript-refs": "^3.0.0" + "purescript-aff": "^5.0.0", + "purescript-refs": "^4.1.0" }, "devDependencies": { - "purescript-test-unit": "^13.0.0", - "purescript-parallel": "^3.3.1" + "purescript-test-unit": "^14.0.0", + "purescript-parallel": "^4.0.0" } } diff --git a/package.json b/package.json index 1d57209..0399d39 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "test": "pulp test" }, "devDependencies": { - "pulp": "^12.0.1", - "purescript": "^0.11.7", + "pulp": "^12.3.0", + "purescript": "^0.12.0", "purescript-psa": "^0.6.0", "rimraf": "^2.6.2" } diff --git a/src/Control/Monad/Aff/Reattempt.purs b/src/Control/Monad/Aff/Reattempt.purs index 18c1de4..ba47cec 100644 --- a/src/Control/Monad/Aff/Reattempt.purs +++ b/src/Control/Monad/Aff/Reattempt.purs @@ -2,9 +2,9 @@ module Control.Monad.Aff.Reattempt where import Prelude -import Control.Monad.Aff (Aff, delay, forkAff, supervise) -import Control.Monad.Eff.Class (liftEff) -import Control.Monad.Eff.Ref (newRef, readRef, writeRef, REF) +import Effect.Aff (Aff, delay, forkAff, supervise) +import Effect.Class (liftEffect) +import Effect.Ref (new, read, write) import Control.Monad.Error.Class (catchError, throwError) import Data.Time.Duration (Milliseconds) @@ -18,14 +18,14 @@ import Data.Time.Duration (Milliseconds) -- | When an attempt to run the provided `Aff` succeeds the `Aff` returned by `reattempt` -- | will succeed. When no attempts succeed the `Aff` returned by `reattempt` will fail -- | with the `Error` raised by the last attempt. -reattempt ∷ ∀ e a. Milliseconds → Aff (ref ∷ REF | e) a → Aff (ref ∷ REF | e) a +reattempt ∷ ∀ a. Milliseconds → Aff a → Aff a reattempt ms aff = supervise do - elapsed ← liftEff $ newRef false + elapsed ← liftEffect $ new false _ ← forkAff do delay ms - liftEff $ writeRef elapsed true + liftEffect $ write true elapsed let attempt = aff `catchError` \error → do - shouldRethrow ← liftEff $ readRef elapsed + shouldRethrow ← liftEffect $ read elapsed if shouldRethrow then throwError error else attempt