Conduction and creation of conduit-based libraries

I know that Conduit is a solution to the problem of streaming data for processing data in read only memory.

I see many libraries in a hack with a channel name attached to it. Some examples: cvs-conduit , zlib-conduit , attoparsec-conduit , etc.

So how to make some kind of simple library channel? Just using the main conduit of the package, can it give a solution for streaming a problem?

I tried to delve into the csv-conduit source, and that was way too complicated. (Well, the path is longer (much more) than the full csv parser implemented in the RWH book.) Also, this github library actually uses Conduit, does it also process streaming data in read-only memory?

+3
source share
1 answer

Yes, the basic conduit package is almost all you need to get started.

The idea is that you organize the workflow in Conduits. Take some items - pull out some items. At a basic level, you can go pretty far using awaitand yield. Just use them in the monad, for example:

idConduit =
  do mElt <- await
     case mElt of
       Nothing -> return ()
       Just element ->
         do yield element
            idConduit

Sink Source mySink $= myConduit1 $= myConduit2 $$ mySource, .

, attoparsec-conduit.

+3

All Articles