1
1
-- | This module defines functions for creating coroutines on top of the `Aff` monad.
2
- -- |
2
+ -- |
3
3
-- | The `Aff` monad only supports actions which return a single value, asynchronously, so this
4
4
-- | module provides a principled way to deal with asynchronous _streams_ of values, and asynchronous consumers
5
5
-- | of streamed data.
@@ -8,23 +8,21 @@ module Control.Coroutine.Aff where
8
8
9
9
import Prelude
10
10
11
- import Data.Maybe
12
- import Data.Either
13
- import Data.Functor (($>))
14
-
15
- import Control.Coroutine
11
+ import Data.Either (Either ())
12
+
13
+ import Control.Coroutine (Producer (), producer )
16
14
import Control.Monad.Eff (Eff ())
17
15
import Control.Monad.Eff.Class (liftEff )
18
16
import Control.Monad.Aff (Aff (), runAff )
19
- import Control.Monad.Aff.AVar (AVar (), AVAR (), makeVar , takeVar , putVar )
17
+ import Control.Monad.Aff.AVar (AVAR (), makeVar , takeVar , putVar )
20
18
import Control.Monad.Trans (lift )
21
-
19
+
22
20
-- | Create a `Producer` using an asynchronous callback.
23
21
-- |
24
- -- | The callback should provide zero or more values of type `a`, which will be
22
+ -- | The callback should provide zero or more values of type `a`, which will be
25
23
-- | emitted by the `Producer`, terminated by an optional value of type `r`. No values
26
24
-- | should be provided after a value of type `r` has been provided.
27
- -- |
25
+ -- |
28
26
-- | For example:
29
27
-- |
30
28
-- | ```purescript
0 commit comments