streamly-examples: Examples for Streamly

[ apache, concurrency, filesystem, network, program, reactivity, streaming, streamly, text ] [ Propose Tags ] [ Report a vulnerability ]

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.


[Skip to Readme]

Flags

Manual Flags

NameDescriptionDefault
fusion-plugin

Use fusion plugin for for best performance

Enabled
sdl2

Include graphics examples using SDL2

Disabled
interop

Include examples of inter-operation with other libraries

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.2.0
Change log Changelog.md
Dependencies base (>=4.9 && <4.20), containers (>=0.5 && <0.8), directory (>=1.2 && <1.4), exceptions (>=0.8 && <0.11), fusion-plugin (>=0.2.6 && <0.3), hashable (>=1.2 && <1.5), mtl (>=2.2 && <3), network (>=2.6 && <4), random (>=1.0.0 && <2), streamly (==0.10.0), streamly-core (==0.2.0), tasty-bench (>=0.3 && <0.4), transformers (>=0.4 && <0.7), transformers-base (>=0.4 && <0.5), unordered-containers (>=0.2 && <0.3), vector (>=0.12 && <0.14) [details]
Tested with ghc ==9.4.4, ghc ==9.2.7, ghc ==9.0.1, ghc ==8.10.7
License Apache-2.0
Copyright Copyright (c) 2019 Composewell Technologies
Author Composewell Technologies
Maintainer streamly@composewell.com
Category Streamly, Streaming, Concurrency, Text, Filesystem, Network, Reactivity
Home page https://streamly.composewell.com
Bug tracker http://github.com/composewell/streamly-examples/issues
Source repo head: git clone git://github.com/composewell/streamly-examples.git
Uploaded by harendra at 2023-12-15T16:29:39Z
Distributions
Executables LogParser, DateTimeParser, FileSystemEvent, Split, Rate, CSVParser, CamelCase, WordCountParallelUTF8, WordCountModular, WordCountParallel, WordCount, WordFrequency, FileSender, EchoServer, CoreUtils, CoreUtilsHandle, ControlFlow, CirclingSquare, AcidRain, MergeSort, ListDir, CmdClient, CmdServer, MergeServer, WordServer, Intro, Interop.Conduit, Interop.Streaming, Interop.Pipes, Interop.Vector
Downloads 444 total (17 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs pending
Build status unknown [no reports yet]

Readme for streamly-examples-0.2.0

[back to package description]

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

When running the unstable version (downloaded from the git repository) you must use --project-file cabal.project.user option otherwise the build might fail. For example:

$ cabal run --project-file cabal.project.user AcidRain

Executable names are the same as the filenames. To run an example:

$ cabal run AcidRain

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: Sort a stream concurrently using merge sort.
  • Rate: Run an action at a given rate.

FileSystem

  • CoreUtils: Implement simplified coreutils like cat, cp, tee, grep using Streamly.FileSystem.File API.
  • CoreUtilsHandle: Implement simplified coreutils using Streamly.FileSystem.Handle API.
  • Split: Implement file splitting utility split.
  • FileSystemEvent: File watching/fsnotify API example.
  • ListDir: List a directory tree recursively and concurrently.

Text Processing

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.

Interoperation

  • Interop.Streaming: Converting streamly stream type to and from streaming stream type.
  • Interop.Pipes: Converting streamly stream type to and from pipes stream type.
  • Interop.Conduit: Converting streamly stream type to and from conduit stream type.
  • Interop.Vector: Converting streamly stream type to and from vector stream type.

Licensing

Available under Apache-2.0 license.