benchmark | ||
examples | ||
src | ||
test | ||
.travis.yml | ||
appveyor.yml | ||
LICENSE | ||
README.md | ||
stack.yaml | ||
streamly.cabal |
Streamly
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.