Created
August 19, 2016 06:41
-
-
Save labra/753bd4de4a52a6adc63e6c1d72097648 to your computer and use it in GitHub Desktop.
Example playing with different computation orders
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 { | |
type C = Fx.fx4[Reader[String,?],State[String,?],Choose,Validate[String,?]] | |
type Check[A] = Eff[C,A] | |
val p : Check[Int] = pure(3) | |
import cats.std.list._ | |
val r1 = p.runChoose.runReader("foo").runState("baz").runNel.run | |
val r2 = p.runChoose.runState("foo").runReader("baz").runNel.run | |
// The following orders don't work | |
// val r3 = p.runNel.runChoose.runReader("foo").runState("baz").run | |
// val r4 = p.runChoose.runNel.runState("foo").runReader("baz").run | |
// val r5 = p.runChoose.runState("foo").runNel.runReader("baz").run | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment