From 003719d937d1b7bf2cf91d7845bc82bf215e83a1 Mon Sep 17 00:00:00 2001 From: Nathan Faubion Date: Wed, 13 Sep 2017 11:08:04 -0700 Subject: [PATCH] Aff updates --- bower.json | 2 +- src/Node/FS/Aff.purs | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bower.json b/bower.json index 24aee00..7aa5cd3 100644 --- a/bower.json +++ b/bower.json @@ -27,7 +27,7 @@ "example" ], "dependencies": { - "purescript-aff": "^3.0.0", + "purescript-aff": "^4.0.0", "purescript-either": "^3.0.0", "purescript-node-fs": "^4.0.0", "purescript-node-path": "^2.0.0" diff --git a/src/Node/FS/Aff.purs b/src/Node/FS/Aff.purs index 2119392..a907277 100644 --- a/src/Node/FS/Aff.purs +++ b/src/Node/FS/Aff.purs @@ -33,10 +33,9 @@ module Node.FS.Aff import Prelude -import Control.Monad.Aff (Aff, makeAff) +import Control.Monad.Aff (Aff, makeAff, nonCanceler) import Control.Monad.Eff (Eff) import Data.DateTime (DateTime) -import Data.Either (either) import Data.Maybe (Maybe) import Node.Buffer (Buffer, BUFFER) import Node.Encoding (Encoding) @@ -51,7 +50,7 @@ import Node.FS (FS) as Exports toAff :: forall eff a. (A.Callback eff a -> Eff (fs :: F.FS | eff) Unit) -> Aff (fs :: F.FS | eff) a -toAff p = makeAff \e a -> p $ either e a +toAff p = makeAff \k -> p k $> nonCanceler toAff1 :: forall eff a x. (x -> A.Callback eff a -> Eff (fs :: F.FS | eff) Unit) -> @@ -263,7 +262,7 @@ appendTextFile = toAff3 A.appendTextFile -- | exists :: forall eff. String -> Aff (fs :: F.FS | eff) Boolean -exists file = makeAff \_ a -> A.exists file a +exists file = makeAff \k -> A.exists file (pure >>> k) $> nonCanceler -- | Open a file asynchronously. See the [Node Documentation](https://nodejs.org/api/fs.html#fs_fs_open_path_flags_mode_callback) -- | for details.