Giter Site home page Giter Site logo

streamly-examples's Introduction

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.

streamly-examples's People

Contributors

adithyaov avatar harendra-kumar avatar pranaysashank avatar rnjtranjan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

streamly-examples's Issues

Most examples are broken in 9.4.4.

Some of these won't compile, others seem to be based on broken libraries, etc...

I like streamly very much, but it's much harder to pick up if the examples are guaranteed to be broken.

Add CIs

  • for major GHC versions
  • GHCJS
  • Linux/macOS/Windows

We can just copy the CIs from streamly

Changes to cabal file

  1. Network package now works with ghcjs, so we can remove the conditional build where network is a dependency
  2. We can factor out dependencies of all examples in a common stanza
  3. Add version bounds to all dependencies

Benchmark the examples

  • The examples can act as real world benchmarks
  • Possibly can be compared with alternate language implementations
  • We can run them with restricted heap and stack to find any memory issues

Add a CI with fusion-plugin

Now that fusion-plugin is essential for performance with parsers and folds, we should be testing everything with it by default.

Limited example of interoperability with the Streaming library.

The Interop.Streaming.fromStreaming example assumes "r ~ ()", but I rarely find that to be the case in code that uses Streaming. Is this an area where Streaming's model is more "powerful" than Streamly's due to different trade-offs, or is there a way to represent "Stream (Of a) m r" in Streamly?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.