High performance, concurrent functional programming abstractions
Go to file
2017-11-30 23:35:43 +05:30
benchmark Rename to Streamly 2017-11-20 18:03:13 +05:30
examples Add note about the canonical examples 2017-11-21 02:50:15 +05:30
src Update (minor) and reorg sections of the tutorial 2017-11-30 23:35:43 +05:30
test Comment out incorrect test 2017-11-20 22:14:39 +05:30
.travis.yml Update the package-test ci script version 2017-10-20 09:34:53 +05:30
appveyor.yml Update the package-test ci script version 2017-10-20 09:34:53 +05:30
LICENSE Use BSD 3-clause license for the lazy implementation 2017-09-04 15:56:05 +05:30
README.md Fix typo. /s/unviversal/universal 2017-11-21 23:16:45 +05:30
stack.yaml Comment out /opt/local/include path inclusion 2017-10-21 03:22:43 +05:30
streamly.cabal Update (minor) and reorg sections of the tutorial 2017-11-30 23:35:43 +05:30

Streamly

Gitter chat Build Status Windows Build status Coverage Status

Streaming Concurrently

Streamly unifies concurrency and streaming in a single monad transformer with a concise and simple API. It provides two ways to combine streams, a monadic product composition as well as the standard pipelined composition provided by streaming libraries. A natural extension of regular monadic composition to streaming and concurrency makes it intuitive and concise with almost universal application. You can write concurrent or non-concurrent applications using simple IO, logic programming, streaming IO or reactive programming (FRP) using the same API. You can also think about it as representing concurrent and composable state machines in imperative terms. It unifies the core functionality provided by async, logict, list-t, conduit/pipes, Yampa/reflex under one type and API. It interworks with the existing streaming libraries.

Magical Concurrency

Streamly provides high level concurrency primitives (higher level than async) and hides the low level concurrency details completely from the programmer. Concurrency can be used with ease in applicative or monadic contexts. The programmer just expresses whether a task can run in parallel with another. Threads, synchronization and concurrency rate control are handled automatically under the hood. The concurrency facilities provided by streamly can be compared with OpenMP and Cilk but with a more declarative expression. Concurrency support does not compromise performance in non-concurrent cases, the performance of the library is at par or better than most of the existing streaming libraries.

Example

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.