Created
August 19, 2016 07:01
-
-
Save labra/15fa48a07c2b6e91f0cade5dbdd15a2f to your computer and use it in GitHub Desktop.
Another example with computation order...
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
package examples | |
import cats._, data._ | |
import org.atnos.eff._, all._ | |
import org.atnos.eff.syntax.all._ | |
object ComputationOrder { | |
//// With 3 effects, it fails when I use runNel at the beginning | |
type C3 = Fx.fx3[State[String,?],Choose,Validate[String,?]] | |
type Check3[A] = Eff[C3,A] | |
val p3 : Check3[Int] = pure(3) | |
import cats.std.list._ | |
val r31 = p3.runChoose.runState("baz").runNel.run | |
val r32 = p3.runChoose.runState("baz").runNel.run | |
// val r33 = p.runNel.runChoose.runState("baz").run | |
//// With 2 effects, it works | |
type C2 = Fx.fx2[Choose,Validate[String,?]] | |
type Check2[A] = Eff[C2,A] | |
val p2 : Check2[Int] = pure(3) | |
import cats.std.list._ | |
val r21 = p2.runChoose.runNel.run | |
val r22 = p2.runNel.runChoose.run | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment