Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@labra
Created August 19, 2016 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save labra/15fa48a07c2b6e91f0cade5dbdd15a2f to your computer and use it in GitHub Desktop.
Save labra/15fa48a07c2b6e91f0cade5dbdd15a2f to your computer and use it in GitHub Desktop.
Another example with computation order...
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