Skip to content
This repository has been archived by the owner on Jan 17, 2020. It is now read-only.

Commit

Permalink
Update for PureScript 0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Bobin committed Jun 25, 2018
1 parent 4073694 commit 8267d54
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
14 changes: 7 additions & 7 deletions src/Control/Monad/Aff/Reattempt.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand Down

0 comments on commit 8267d54

Please sign in to comment.