tao-pr / cats-playground

Collection of cats-effects / fs2 examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cats-playground

An example cats-effect application built from the ce3.g8 template.

Configure the application

Cats-playground consists of multiple run modes which can be configured which to run. Check out application.conf. The config run-mode defines which mode to run.

Run application

sbt run

Run modes

The project includes following playground runners

Runner Task Using
CombinedJsonRunner Streams (fs2) multiple JSON files, parses and combines them
  • fs2 (Files, Stream)
  • Monoid
CsvToJsonRunner Streams (fs2) multiple CSV files, parses them and writes in to multiple JSON files
  • fs2 (Files, Stream)
  • Monoid
EvalRunner Runs Evals as Fibers
  • Eval
  • Fiber (join)
  • OptionT
ForkRunner Forks multiple Fibers with artificial wait time and shares atomic state across them
  • Ref
  • Temporal
  • Fiber
GenerateCsvRunner Generates multiple CSV files and simulates errors
  • Parallel (parTraverse)
PiMCRunner Simulates Pi estimation from Monte-Carlo method concurrently
  • Parallel (parTraverse)
RaceRunner Generates racing conditions of multiple threads which can also throw exceptions
  • Fiber
  • ApplicativeError (via F.raiseError)
  • Temporal
  • Concurrent (racePair)
SemaphoreRunner Endlessly runs scheduler which only runs an execution when resources are available (and permitted)
  • Semaphore
  • Ref
  • Stream (awakeEvery)
AttemptRunner Runs chains of operations which transforms data with functional error handling
  • Ior
  • Validated
  • Monoid (combineAll)
  • Parallel (parTraverse)
IOBoundRunner Runs IO-blocking task and CPU-bound task in parallel
  • Parallel (parTraverse)
  • Temporal (sleep)
  • Sync (blocking)
  • parMapN

Good resources for cats-effects / cats-io / fs2

Licence

MIT

About

Collection of cats-effects / fs2 examples

License:MIT License


Languages

Language:Scala 100.0%