1- module Control.Monad.Aff
1+ module Control.Monad.Aff
22 ( Aff ()
33 , Canceler ()
44 , PureAff (..)
@@ -10,10 +10,11 @@ module Control.Monad.Aff
1010 , launchAff
1111 , liftEff'
1212 , makeAff
13+ , makeAff'
1314 , nonCanceler
1415 , runAff
1516 )
16- where
17+ where
1718
1819 import Data.Either (Either (..), either )
1920 import Data.Function (Fn2 (), Fn3 (), runFn2 , runFn3 )
@@ -29,7 +30,7 @@ module Control.Monad.Aff
2930 import Control.Monad.Eff.Class
3031 import Control.Monad.Error.Class (MonadError , throwError )
3132
32- -- | A computation with effects `e`. The computation either errors or
33+ -- | A computation with effects `e`. The computation either errors or
3334 -- | produces a value of type `a`.
3435 -- |
3536 -- | This is moral equivalent of `ErrorT (ContT Unit (Eff e)) a`.
@@ -40,24 +41,24 @@ module Control.Monad.Aff
4041
4142 type Canceler e = Error -> Aff e Boolean
4243
43- -- | Converts the asynchronous computation into a synchronous one. All values
44+ -- | Converts the asynchronous computation into a synchronous one. All values
4445 -- | and errors are ignored.
4546 launchAff :: forall e a. Aff e a -> Eff e Unit
4647 launchAff = runAff (const (pure unit)) (const (pure unit))
4748
48- -- | Runs the asynchronous computation. You must supply an error callback and a
49+ -- | Runs the asynchronous computation. You must supply an error callback and a
4950 -- | success callback.
5051 runAff :: forall e a. (Error -> Eff e Unit ) -> (a -> Eff e Unit ) -> Aff e a -> Eff e Unit
5152 runAff ex f aff = runFn3 _runAff ex f aff
5253
53- -- | Creates an asynchronous effect from a function that accepts error and
54+ -- | Creates an asynchronous effect from a function that accepts error and
5455 -- | success callbacks. This function can be used for asynchronous computations
5556 -- | that cannot be canceled.
5657 makeAff :: forall e a. ((Error -> Eff e Unit) -> (a -> Eff e Unit) -> Eff e Unit ) -> Aff e a
5758 makeAff h = makeAff' (\e a -> const nonCanceler <$> h e a )
5859
59- -- | Creates an asynchronous effect from a function that accepts error and
60- -- | success callbacks, and returns a canceler for the computation. This
60+ -- | Creates an asynchronous effect from a function that accepts error and
61+ -- | success callbacks, and returns a canceler for the computation. This
6162 -- | function can be used for asynchronous computations that can be canceled.
6263 makeAff' :: forall e a. ((Error -> Eff e Unit) -> (a -> Eff e Unit) -> Eff e (Canceler e)) -> Aff e a
6364 makeAff' h = _makeAff h
@@ -70,7 +71,7 @@ module Control.Monad.Aff
7071 later' :: forall e a. Number -> Aff e a -> Aff e a
7172 later' n aff = runFn3 _setTimeout nonCanceler n aff
7273
73- -- | Forks the specified asynchronous computation so subsequent monadic binds
74+ -- | Forks the specified asynchronous computation so subsequent monadic binds
7475 -- | will not block on the result of the computation.
7576 forkAff :: forall e a. Aff e a -> Aff e (Canceler e )
7677 forkAff aff = runFn2 _forkAff nonCanceler aff
@@ -114,7 +115,7 @@ module Control.Monad.Aff
114115 instance monadEffAff :: MonadEff e (Aff e ) where
115116 liftEff eff = runFn2 _liftEff nonCanceler eff
116117
117- -- | Allows users to catch and throw errors on the error channel of the
118+ -- | Allows users to catch and throw errors on the error channel of the
118119 -- | asynchronous computation. See documentation in `purescript-transformers`.
119120 instance monadErrorAff :: MonadError Error (Aff e ) where
120121 throwError e = runFn2 _throwError nonCanceler e
@@ -149,7 +150,7 @@ module Control.Monad.Aff
149150 return canceler(e)(success, error);
150151 } else {
151152 cancel = true;
152-
153+
153154 clearTimeout(timeout);
154155
155156 try {
@@ -216,7 +217,7 @@ module Control.Monad.Aff
216217 } catch (e) {
217218 error(e);
218219 }
219-
220+
220221 return canceler;
221222 }
222223 }" " " :: forall e a. Fn2 (Canceler e ) a (Aff e a )
@@ -225,7 +226,7 @@ module Control.Monad.Aff
225226 function _throwError(canceler, e) {
226227 return function(success, error) {
227228 error(e);
228-
229+
229230 return canceler;
230231 }
231232 }" " " :: forall e a. Fn2 (Canceler e ) Error (Aff e a )
@@ -247,15 +248,15 @@ module Control.Monad.Aff
247248 function _bind(aff, f) {
248249 return function(success, error) {
249250 var canceler;
250-
251+
251252 canceler = aff(function(v) {
252- try {
253+ try {
253254 canceler = f(v)(success, error);
254255 } catch (e) {
255256 error(e);
256257 }
257258 }, error);
258-
259+
259260 return function(e) {
260261 return function(success, error) {
261262 return canceler(e)(success, error);
@@ -306,7 +307,7 @@ module Control.Monad.Aff
306307 } catch (e) {
307308 error(e);
308309 }
309-
310+
310311 return canceler;
311312 };
312313 }" " " :: forall e a. Fn2 (Canceler e ) (Eff e a ) (Aff e a )
0 commit comments