1
1
mirror of https://github.com/sdiehl/wiwinwlh.git synced 2024-08-16 15:30:35 +03:00

Update tutorial.md

This commit is contained in:
Alexander Bondarenko 2020-02-18 15:22:13 +03:00 committed by GitHub
parent 5d965fda96
commit 3472aacdf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12697,20 +12697,22 @@ Conduits
```haskell
await :: Monad m => ConduitM i o m (Maybe i)
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
type Source m o = ConduitM () o m ()
type Conduit i m o = ConduitM i o m ()
runConduit :: Monad m => ConduitT () Void m r -> m r
(.|) :: Monad 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
space deterministic resource handling for IO resources.
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
operator (``=$``) for combining Sources and Sink and a Conduit and a Sink respectively.
termination.
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"}
~~~~