streamly/README.md
Harendra Kumar a74a0c0844 Rename to Streamly
Streamly is a more appropriate name and conveys the core idea. Stream
concurrently = streamly.
2017-11-20 18:03:13 +05:30

2.3 KiB

Streamly

Build Status Windows Build status Coverage Status

Streamly is a general streaming and concurrent programming monad allowing you to write a wide variety of applications ranging from simple applications utilizing streaming IO to massively parallel concurrent applications as well as reactive (FRP) applications with the same ease. Streamly provides high level concurrency primitives and hides the low level concurrency details completely from the programmer. The programmer just expresses whether a task can run in parallel with another. Threads, synchronization and concurrency rate control are handled automatically. The library has been written keeping high performance applications in mind.

Streamly subsumes all the use cases of list transformer (list-t) and logic programming (logict) monads and adds concurrency on top. It is a streaming library and therefore can be used for most of the streaming use cases as well (i.e. where you would use conduit or pipes) with concurrency added. It is also a first class reactive programming library and can be used where you would use libraries like Yampa or reflex. One way to think about it is to think of it as composable state machines with concurrency. You can write from really simple to complex applications, from streaming to FRP or massively concurrent applications using the same simple and concise abstractions.

Here is a simple example to concurrently and recursively list the contents of a directory tree:

import Path.IO (listDir, getCurrentDir)
import Streamly

main = runStreaming $ serially $ getCurrentDir >>= readdir
   where readdir d = do
            (dirs, files) <- lift $ listDir d
            liftIO $ mapM_ putStrLn $ map show files
            foldMapWith (<|>) readdir dirs

See "Streamly.Tutorial" and "Streamly.Examples" for more details.

This library was originally inspired by the transient package authored by Alberto G. Corona.