Installation

You add eff as an sbt dependency:

To get types like Reader[String, ?] (with more than one type parameter) correctly inferred, you’ll have to use the following compiler option

Additional dependencies

This table lists the other available eff modules:

Name Functionality
eff-scalaz if you want to use Scalaz as a library for functional programming. This gives you a Scalaz Monad instance for Eff and a Scalaz’s Task effect
eff-monix to use Monix’s Task effect
eff-cats-effect to use cats’s IO effect
eff-twitter to use Twitter’s Future effect
eff-doobie to use Doobie’s ConnectionIO effect

Imports

Main types

The main eff types: Eff, Member, Fx are accessible in the org.atnos.eff package:

Many other effects are also available Out of the box.

Creating effects

The functions used to create effects are grouped under different objects named after the effect type. For example if you want to create the Eval effect you need to import:

You can also import most of the effects at once with:

The only effects not included in the previous import are:

Interpreting effects

Interpreting effects usually requires some syntax to “run” a given effect. For example to “run” the Option effect you will import:

You can also access all the syntax imports at once with:

Intellij support

Intellij error highlighting doesn’t support implicit-directed type inference yet, check https://youtrack.jetbrains.com/issue/SCL-11140 or https://youtrack.jetbrains.com/issue/SCL-10753 for progress.

With Scalaz

If you use Scalaz as your functional programming library you might need additional imports in order to use some creation methods specific to Scalaz. For example:

There is also an all object importing all those methods at once:

And you can already guess, there are some syntax imports following the same pattern: