mirror of
https://github.com/sdiehl/wiwinwlh.git
synced 2024-09-11 12:05:25 +03:00
Update tutorial.md
This commit is contained in:
parent
5d965fda96
commit
3472aacdf7
16
tutorial.md
16
tutorial.md
@ -12697,20 +12697,22 @@ Conduits
|
|||||||
```haskell
|
```haskell
|
||||||
await :: Monad m => ConduitM i o m (Maybe i)
|
await :: Monad m => ConduitM i o m (Maybe i)
|
||||||
yield :: Monad m => o -> ConduitM i o m ()
|
yield :: Monad m => o -> ConduitM i o m ()
|
||||||
($$) :: Monad m => Source m a -> Sink a m b -> m b
|
|
||||||
(=$) :: Monad m => Conduit a m b -> Sink b m c -> Sink a m c
|
|
||||||
|
|
||||||
type Sink i = ConduitM i Void
|
runConduit :: Monad m => ConduitT () Void m r -> m r
|
||||||
type Source m o = ConduitM () o m ()
|
(.|) :: Monad m
|
||||||
type Conduit i m o = ConduitM i o m ()
|
=> ConduitM a b m ()
|
||||||
|
-> ConduitM b c m r
|
||||||
|
-> ConduitM a c m r
|
||||||
```
|
```
|
||||||
|
|
||||||
Conduits are conceptually similar though philosophically different approach to the same problem of constant
|
Conduits are conceptually similar though philosophically different approach to the same problem of constant
|
||||||
space deterministic resource handling for IO resources.
|
space deterministic resource handling for IO resources.
|
||||||
|
|
||||||
The first initial difference is that await function now returns a ``Maybe`` which allows different handling of
|
The first initial difference is that await function now returns a ``Maybe`` which allows different handling of
|
||||||
termination. The composition operators are also split into a connecting operator (``$$``) and a fusing
|
termination.
|
||||||
operator (``=$``) for combining Sources and Sink and a Conduit and a Sink respectively.
|
|
||||||
|
Since 1.2.8 the separate connecting and fusing operators are deprecated in favor of a single fusing operator
|
||||||
|
``(.|)``.
|
||||||
|
|
||||||
~~~~ {.haskell include="src/25-streaming/conduit.hs"}
|
~~~~ {.haskell include="src/25-streaming/conduit.hs"}
|
||||||
~~~~
|
~~~~
|
||||||
|
Loading…
Reference in New Issue
Block a user