@hackage streamly-examples0.1.1
Examples for Streamly
Categories
License
Apache-2.0
Maintainer
streamly@composewell.com
Links
Versions
Installation
Tested Compilers
Dependencies (0)
- base >=4.9 && <4.17
- conduit >=1.3.4.1 && <1.3.5
- containers >=0.5 && <0.7
- directory >=1.2 && <1.4
- exceptions >=0.8 && <0.11
- fusion-plugin >=0.2 && <0.3 Show all…
Dependents (0)
Package Flags
fusion-plugin
(off by default)
Use fusion plugin for for best performance
sdl2
(off by default)
Include graphics examples using SDL2
interop
(off by default)
Include examples of inter-operation with other libraries
Streamly Examples
Practical examples to demonstrate the features and performance of Streamly. Includes examples about file IO, text processing, networking, concurrent programming, reactive programming and more.
These examples also serve as a beginner's guide to express practical programs using the dataflow programming (streaming) model. Please visit the Streamly homepage for more details and comprehensive documentation.
Running The Examples
Executable names are the same as the filenames. To run an example:
$ cabal run AcidRain
For performance sensitive examples use fusion-plugin for best performance:
$ cabal run --flag fusion-plugin WordCount -- streamly-examples.cabal
To run SDL2 based examples, make sure that you have the OS package for the sdl2 library installed on your system and the headers are visible to cabal:
$ cabal run --flag sdl2 CirclingSquare
To run interop examples, use the interop build flag:
$ cabal run --flag interop Interop.Pipes
List of examples
General
- Intro: Simple, introductory examples - loops, text processing, networking, concurrency.
- MergeSort: Merge sorted streams concurrently.
- Rate: Run an action at a given rate.
FileSystem
- CoreUtils: Implement simplified coreutils
like
cat,cp,tee,grepusingStreamly.FileSystem.FileAPI. - CoreUtilsHandle: Implement simplified
coreutils using
Streamly.FileSystem.HandleAPI. - Split: Implement file splitting utility
split. - FileSystemEvent: File watching/fsnotify API example.
- ListDir: List a directory tree recursively and concurrently.
Text Processing
- CamelCase: Convert a file to camel case.
- WordCount: Simple word counting (
wc) program. - WordCount.c: C equivalent for perf comparison.
- WordCountModular: Modular version.
- WordCountParallel: Concurrent version.
- WordCountParallelUTF8: Concurrent version with full UTF8 handling.
- WordFrequency: Count word frequency in a file and print top 25 words.
- CSVParser: Process a CSV file
Networking
- EchoServer: A concurrent TCP server that echoes everything that it receives.
- MergeServer: Merges lines received from several client connections and writes them to a file.
- FileSender: Send many files concurrently to
a server over multiple connections. Can be used to test
MergeServer. - CmdServer: Receive a stream of commands from many clients and respond to them using command handlers.
- CmdClient: Run multiple concurrent clients sending
streams of commands to a server and receiving responses. Can be used to test
CmdServer. - WordServer: A word look up (dictionary) server, instead of performing a real DB query the server just adds a time delay to simulate the IO.
FRP/Games/Animation
- AcidRain: A console game with deteriorating health that can be modified by typing "harm" and "potion" commands.
- CirclingSquare: Use SDL2 to display a square that moves in a circle, and follows the mouse pointer.
Monad Transformers
- ControlFlow: Combining control flow manipulating
transformers (
MaybeT,ExceptT,ContT) with streamly.
Interoperation
- Interop.Streaming: Converting streamly
stream type to and from
streamingstream type. - Interop.Pipes: Converting streamly
stream type to and from
pipesstream type. - Interop.Conduit: Converting streamly
stream type to and from
conduitstream type. - Interop.Vector: Converting streamly
stream type to and from
vectorstream type.
Licensing
Available under Apache-2.0 license.