Skip to content
This repository was archived by the owner on Aug 4, 2023. It is now read-only.

Commit 3d8e020

Browse files
authored
Merge pull request #18 from natefaubion/aff-updates
Aff updates
2 parents d4b4bf6 + 003719d commit 3d8e020

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"example"
2828
],
2929
"dependencies": {
30-
"purescript-aff": "^3.0.0",
30+
"purescript-aff": "^4.0.0",
3131
"purescript-either": "^3.0.0",
3232
"purescript-node-fs": "^4.0.0",
3333
"purescript-node-path": "^2.0.0"

src/Node/FS/Aff.purs

+3-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ module Node.FS.Aff
3333

3434
import Prelude
3535

36-
import Control.Monad.Aff (Aff, makeAff)
36+
import Control.Monad.Aff (Aff, makeAff, nonCanceler)
3737
import Control.Monad.Eff (Eff)
3838
import Data.DateTime (DateTime)
39-
import Data.Either (either)
4039
import Data.Maybe (Maybe)
4140
import Node.Buffer (Buffer, BUFFER)
4241
import Node.Encoding (Encoding)
@@ -51,7 +50,7 @@ import Node.FS (FS) as Exports
5150
toAff :: forall eff a.
5251
(A.Callback eff a -> Eff (fs :: F.FS | eff) Unit) ->
5352
Aff (fs :: F.FS | eff) a
54-
toAff p = makeAff \e a -> p $ either e a
53+
toAff p = makeAff \k -> p k $> nonCanceler
5554

5655
toAff1 :: forall eff a x.
5756
(x -> A.Callback eff a -> Eff (fs :: F.FS | eff) Unit) ->
@@ -263,7 +262,7 @@ appendTextFile = toAff3 A.appendTextFile
263262
-- |
264263
exists :: forall eff. String
265264
-> Aff (fs :: F.FS | eff) Boolean
266-
exists file = makeAff \_ a -> A.exists file a
265+
exists file = makeAff \k -> A.exists file (pure >>> k) $> nonCanceler
267266

268267
-- | Open a file asynchronously. See the [Node Documentation](https://nodejs.org/api/fs.html#fs_fs_open_path_flags_mode_callback)
269268
-- | for details.

0 commit comments

Comments
 (0)