ekmett / machines

Networks of composable stream transducers
Other
339 stars 46 forks source link

More complex examples #101

Closed jchia closed 6 years ago

jchia commented 6 years ago

It seems that the current examples are all about processing some input homogeneously. Can there be an example of a more complicated use case where for example, a file header is read and the content of the header determines how the rest of the file is processed? Is such processing possible with machines?

For example: The file header is a Word8 n followed by n (Word8, Word8) pairs (x, y). After that the rest of the file is processed byte-by-byte: If some byte b matches any x, the corresponding yis output. Otherwise, b is output.

YoEight commented 6 years ago

I use machines in my GetEventStore client, I don't have much documentation for that internal stuff but I hope it helps: https://code.coppermine.io/eventsourcing/haskell-ges/blob/dev/1.0/Database/EventStore/Internal/Operation.hs