You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import cats._, data._
import org.atnos.eff._
type ReaderInt[A] = Reader[Int, A]
type WriterString[A] = Writer[String, A]
type Stack = Fx.fx3[WriterString, ReaderInt, Eval]
import org.atnos.eff.all._
import org.atnos.eff.syntax.all._
// useful type aliases showing that the ReaderInt and the WriterString effects are "members" of R
// note that R could have more effects
type _readerInt[R] = ReaderInt |= R
type _writerString[R] = WriterString |= R
def program[R :_readerInt :_writerString :_eval]: Eff[R, Int] = for {
// get the configuration
n <- ask[R, Int]
// log the current configuration value
_ <- tell("the required power is "+n)
// compute the nth power of 2
a <- delay(math.pow(2, n.toDouble).toInt)
// log the result
_ <- tell("the result is "+a)
} yield a
// run the action with all the interpreters
// each interpreter running one effect
program[Stack].runReader(6).runWriter.runEval.run
After compilation get:
No instance found for Member[[β$0$]cats.data.Kleisli[[A]A,Int,β$0$], A$A57.this.Stack].
The effect [β$0$]cats.data.Kleisli[[A]A,Int,β$0$] is not part of the stack A$A57.this.Stack
or it was not possible to determine the stack that would result from removing [β$0$]cats.data.Kleisli[[A]A,Int,β$0$] from A$A57.this.Stack
program[Stack].runReader(6).runWriter.runEval.run;}
^
After compilation get:
What i do wrong? I took this example from introduction http://atnos-org.github.io/eff/org.atnos.site.Introduction.html
The text was updated successfully, but these errors were encountered: