Skip to content

Latest commit

 

History

History
89 lines (56 loc) · 3.19 KB

README.md

File metadata and controls

89 lines (56 loc) · 3.19 KB

Effect Zoo for Scala 3

Inspired by Effect Zoo for Haskell.

Effect Zoo provides:

  1. Code gallery, where we can demonstrate and compare the syntax of different effect systems, when they are assigned the same task. The sources are located here.

  2. Microbenchmark suite. See running instruction below.

Included scenarios (contests):

  • cdown: The CountDown scenario from Haskell's Effect Zoo. Uses single State effect.

  • sumh: In the spirit of CountDown, but uses more effects: Reader, Writer, State, etc.

  • mulst: Multiple instances of State effects used at the same time. Compares overhead of effect stack size, by running the same number of State operations, spread over a varying number State effects (1 to 5).

  • reint: The Reinterpretation scenario from Haskell's Effect Zoo. Demonstrates use of custom-defined effects as application modules, and effect reinterpretation as DI mechanism.

Included effect systems:

There are many more effect systems for Scala (e.g. 3 more implementations of the Eff monad alone), but they are unmaintained and unavailable for Scala 2.13 or 3.x.

Running Microbenchmarks

  • Step 0: Ensure you have a modern terminal.

    Without support for Unicode characters and True Color, charts won't be displayed properly. If you are on Windows, old cmd.exe or PowerShell will get you garbage on the screen. The New Terminal might work (unconfirmed).

  • Step 1: Ensure you have Java 11 or newer.

  • Step 2: Have sbt installed.

    https://www.scala-sbt.org/download.html

  • Step 3: Get a local copy of this repo and launch sbt:

    git clone https://github.com/marcinzh/effect-zoo.git
    cd effect-zoo
    sbt
    
  • Step 4: From sbt's command prompt, pick one method:

    • Run JMH by using predefined alias (takes ~20 minutes to complete):

      runbench
      
    • Run JMH directly, with your own parameters, e.g:

      bench/Jmh/run -i 3 -wi 3 -f1 -t1 -r 3 -w 3 .*Cdown
      
    • Run Effect-Zoo's own, simple microbenchmark tool. It's less accurate than JMH, but completes much sooner (under 3 minutes):

      diy/run --all