Created
September 10, 2016 13:09
-
-
Save benhutchison/b5d8267a764a22ca893af078ba3a3a27 to your computer and use it in GitHub Desktop.
Problems translating Effect stack in eff-cats 2.0-RC7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Welcome to the Ammonite Repl 0.6.2 | |
(Scala 2.11.8 Java 1.8.0_51) | |
@ load.plugin.ivy("com.milessabin" % "si2712fix-plugin_2.11.8" % "1.2.0") | |
@ load.plugin.ivy("org.spire-math" %% "kind-projector" % "0.8.0") | |
@ load.ivy("org.atnos" %% "eff-cats" % "2.0.0-RC7") | |
@ import org.atnos.eff._, all._, syntax.all._; | |
import org.atnos.eff._, all._, syntax.all._; | |
@ import cats._, data._, implicits._; | |
import cats._, data._, implicits._; | |
@ import org.atnos.eff.Interpret.Translate | |
import org.atnos.eff.Interpret.Translate | |
@ def readerToState[E, S](implicit s: State[S, ?] <= E): Translate[Reader[S, ?], E] = new Translate[Reader[S, ?], E] { | |
def apply[A](fa: Reader[S, A]): Eff[E, A] = | |
send(State((s: S) => (s, fa.run(s)))) | |
} | |
defined function readerToState | |
@ type ReadStr[E] = Member[Reader[String, ?], E] | |
defined type ReadStr | |
@ type StateStr[E] = Member[State[String, ?], E] | |
defined type StateStr | |
@ def methodWithReadEffect[E: ReadStr: _Option]: Eff[E, Unit] = ??? | |
defined function methodWithReadEffect | |
@ import org.atnos.eff.Fx.prepend | |
import org.atnos.eff.Fx.prepend | |
@ | |
def methodWithStateEffect[E: StateStr: _Option]: Eff[E, Unit] = for {_ <- methodWithReadEffect[prepend[Reader[String, ?], E]].translate(readerToState[E, String])} yield () | |
cmd11.scala:1: No instance found for Member[Option, org.atnos.eff.Fx.prepend[[β$0$]cats.data.Kleisli[[A]A,String,β$0$],E]]. | |
The effect Option is not part of the stack org.atnos.eff.Fx.prepend[[β$0$]cats.data.Kleisli[[A]A,String,β$0$],E] | |
or it was not possible to determine the stack that would result from removing Option from org.atnos.eff.Fx.prepend[[β$0$]cats.data.Kleisli[[A]A,String,β$0$],E] | |
def methodWithStateEffect[E: StateStr: _Option]: Eff[E, Unit] = for {_ <- methodWithReadEffect[prepend[Reader[String, ?], E]].translate(readerToState[E, String])} yield () | |
^ | |
Compilation Failed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment