Skip to content

Instantly share code, notes, and snippets.

@tscholak
Last active June 13, 2017 02:38
Show Gist options
  • Save tscholak/bc6b3729bba73ade932a0e6bd7f7b9da to your computer and use it in GitHub Desktop.
Save tscholak/bc6b3729bba73ade932a0e6bd7f7b9da to your computer and use it in GitHub Desktop.
eff poop
import _root_.cats.data.{Reader, Writer}
import org.atnos.eff._
import org.atnos.eff.all._
import org.atnos.eff.syntax.all._
object poop {
case class T1(s: String)
case class T2(s: String)
case class T3(s: String)
case class T4(s: String)
implicit class EffOps[S, A](e: Eff[S, A]) {
def runT1Writer[U, TX](implicit writer: Member.Aux[Writer[T1, ?], S, U],
reader: Reader[TX, ?] |= U): Eff[U, A] =
for {
_ <- ask[U, TX]
a <- e.runWriter.map(_._1)
} yield a
}
type R1x234 = FxAppend[Fx1[Writer[T1, ?]], Fx3[Reader[T2, ?], Writer[T3, ?], Writer[T4, ?]]]
val e1x234: Eff[R1x234, Unit] = pure(())
e1x234.runT1Writer
type R1x243 = FxAppend[Fx1[Writer[T1, ?]], Fx3[Reader[T2, ?], Writer[T4, ?], Writer[T3, ?]]]
val e1x243: Eff[R1x243, Unit] = pure(())
e1x243.runT1Writer
type R1x324 = FxAppend[Fx1[Writer[T1, ?]], Fx3[Writer[T3, ?], Reader[T2, ?], Writer[T4, ?]]]
val e1x324: Eff[R1x324, Unit] = pure(())
e1x324.runT1Writer
type R1x342 = FxAppend[Fx1[Writer[T1, ?]], Fx3[Writer[T3, ?], Writer[T4, ?], Reader[T2, ?]]]
val e1x342: Eff[R1x342, Unit] = pure(())
e1x342.runT1Writer
type R1x423 = FxAppend[Fx1[Writer[T1, ?]], Fx3[Writer[T4, ?], Reader[T2, ?], Writer[T3, ?]]]
val e1x423: Eff[R1x423, Unit] = pure(())
e1x423.runT1Writer
type R1x432 = FxAppend[Fx1[Writer[T1, ?]], Fx3[Writer[T4, ?], Writer[T3, ?], Reader[T2, ?]]]
val e1x432: Eff[R1x432, Unit] = pure(())
e1x432.runT1Writer
type R2x134 = FxAppend[Fx1[Reader[T2, ?]], Fx3[Writer[T1, ?], Writer[T3, ?], Writer[T4, ?]]]
val e2x134: Eff[R2x134, Unit] = pure(())
e2x134.runT1Writer
type R2x143 = FxAppend[Fx1[Reader[T2, ?]], Fx3[Writer[T1, ?], Writer[T4, ?], Writer[T3, ?]]]
val e2x143: Eff[R2x143, Unit] = pure(())
e2x143.runT1Writer
type R2x314 = FxAppend[Fx1[Reader[T2, ?]], Fx3[Writer[T3, ?], Writer[T1, ?], Writer[T4, ?]]]
val e2x314: Eff[R2x314, Unit] = pure(())
e2x314.runT1Writer
type R2x341 = FxAppend[Fx1[Reader[T2, ?]], Fx3[Writer[T3, ?], Writer[T4, ?], Writer[T1, ?]]]
val e2x341: Eff[R2x341, Unit] = pure(())
e2x341.runT1Writer
type R2x413 = FxAppend[Fx1[Reader[T2, ?]], Fx3[Writer[T4, ?], Writer[T1, ?], Writer[T3, ?]]]
val e2x413: Eff[R2x413, Unit] = pure(())
e2x413.runT1Writer
type R2x431 = FxAppend[Fx1[Reader[T2, ?]], Fx3[Writer[T4, ?], Writer[T3, ?], Writer[T1, ?]]]
val e2x431: Eff[R2x431, Unit] = pure(())
e2x431.runT1Writer
type R3x124 = FxAppend[Fx1[Writer[T3, ?]], Fx3[Writer[T1, ?], Reader[T2, ?], Writer[T4, ?]]]
val e3x124: Eff[R3x124, Unit] = pure(())
e3x124.runT1Writer
type R3x142 = FxAppend[Fx1[Writer[T3, ?]], Fx3[Writer[T1, ?], Writer[T4, ?], Reader[T2, ?]]]
val e3x142: Eff[R3x142, Unit] = pure(())
e3x142.runT1Writer
type R3x214 = FxAppend[Fx1[Writer[T3, ?]], Fx3[Reader[T2, ?], Writer[T1, ?], Writer[T4, ?]]]
val e3x214: Eff[R3x214, Unit] = pure(())
e3x214.runT1Writer
type R3x241 = FxAppend[Fx1[Writer[T3, ?]], Fx3[Reader[T2, ?], Writer[T4, ?], Writer[T1, ?]]]
val e3x241: Eff[R3x241, Unit] = pure(())
e3x241.runT1Writer
type R3x412 = FxAppend[Fx1[Writer[T3, ?]], Fx3[Writer[T4, ?], Writer[T1, ?], Reader[T2, ?]]]
val e3x412: Eff[R3x412, Unit] = pure(())
e3x412.runT1Writer
type R3x421 = FxAppend[Fx1[Writer[T3, ?]], Fx3[Writer[T4, ?], Reader[T2, ?], Writer[T1, ?]]]
val e3x421: Eff[R3x421, Unit] = pure(())
e3x421.runT1Writer
type R4x123 = FxAppend[Fx1[Writer[T4, ?]], Fx3[Writer[T1, ?], Reader[T2, ?], Writer[T3, ?]]]
val e4x123: Eff[R4x123, Unit] = pure(())
e4x123.runT1Writer
type R4x132 = FxAppend[Fx1[Writer[T4, ?]], Fx3[Writer[T1, ?], Writer[T3, ?], Reader[T2, ?]]]
val e4x132: Eff[R4x132, Unit] = pure(())
e4x132.runT1Writer
type R4x213 = FxAppend[Fx1[Writer[T4, ?]], Fx3[Reader[T2, ?], Writer[T1, ?], Writer[T3, ?]]]
val e4x213: Eff[R4x213, Unit] = pure(())
e4x213.runT1Writer
type R4x231 = FxAppend[Fx1[Writer[T4, ?]], Fx3[Reader[T2, ?], Writer[T3, ?], Writer[T1, ?]]]
val e4x231: Eff[R4x231, Unit] = pure(())
e4x231.runT1Writer
type R4x312 = FxAppend[Fx1[Writer[T4, ?]], Fx3[Writer[T3, ?], Writer[T1, ?], Reader[T2, ?]]]
val e4x312: Eff[R4x312, Unit] = pure(())
e4x312.runT1Writer
type R4x321 = FxAppend[Fx1[Writer[T4, ?]], Fx3[Writer[T3, ?], Reader[T2, ?], Writer[T1, ?]]]
val e4x321: Eff[R4x321, Unit] = pure(())
e4x321.runT1Writer
type R12x34 = FxAppend[Fx2[Writer[T1, ?], Reader[T2, ?]], Fx2[Writer[T3, ?], Writer[T4, ?]]]
val e12x34: Eff[R12x34, Unit] = pure(())
e12x34.runT1Writer
type R12x43 = FxAppend[Fx2[Writer[T1, ?], Reader[T2, ?]], Fx2[Writer[T4, ?], Writer[T3, ?]]]
val e12x43: Eff[R12x43, Unit] = pure(())
e12x43.runT1Writer
type R13x24 = FxAppend[Fx2[Writer[T1, ?], Writer[T3, ?]], Fx2[Reader[T2, ?], Writer[T4, ?]]]
val e13x24: Eff[R13x24, Unit] = pure(())
e13x24.runT1Writer
type R13x42 = FxAppend[Fx2[Writer[T1, ?], Writer[T3, ?]], Fx2[Writer[T4, ?], Reader[T2, ?]]]
val e13x42: Eff[R13x42, Unit] = pure(())
e13x42.runT1Writer
type R14x23 = FxAppend[Fx2[Writer[T1, ?], Writer[T4, ?]], Fx2[Reader[T2, ?], Writer[T3, ?]]]
val e14x23: Eff[R14x23, Unit] = pure(())
e14x23.runT1Writer
type R14x32 = FxAppend[Fx2[Writer[T1, ?], Writer[T4, ?]], Fx2[Writer[T3, ?], Reader[T2, ?]]]
val e14x32: Eff[R14x32, Unit] = pure(())
e14x32.runT1Writer
type R21x34 = FxAppend[Fx2[Reader[T2, ?], Writer[T1, ?]], Fx2[Writer[T3, ?], Writer[T4, ?]]]
val e21x34: Eff[R21x34, Unit] = pure(())
e21x34.runT1Writer
type R21x43 = FxAppend[Fx2[Reader[T2, ?], Writer[T1, ?]], Fx2[Writer[T4, ?], Writer[T3, ?]]]
val e21x43: Eff[R21x43, Unit] = pure(())
e21x43.runT1Writer
type R23x14 = FxAppend[Fx2[Reader[T2, ?], Writer[T3, ?]], Fx2[Writer[T1, ?], Writer[T4, ?]]]
val e23x14: Eff[R23x14, Unit] = pure(())
e23x14.runT1Writer
type R23x41 = FxAppend[Fx2[Reader[T2, ?], Writer[T3, ?]], Fx2[Writer[T4, ?], Writer[T1, ?]]]
val e23x41: Eff[R23x41, Unit] = pure(())
e23x41.runT1Writer
type R24x13 = FxAppend[Fx2[Reader[T2, ?], Writer[T4, ?]], Fx2[Writer[T1, ?], Writer[T3, ?]]]
val e24x13: Eff[R24x13, Unit] = pure(())
e24x13.runT1Writer
type R24x31 = FxAppend[Fx2[Reader[T2, ?], Writer[T4, ?]], Fx2[Writer[T3, ?], Writer[T1, ?]]]
val e24x31: Eff[R24x31, Unit] = pure(())
e24x31.runT1Writer
type R31x24 = FxAppend[Fx2[Writer[T3, ?], Writer[T1, ?]], Fx2[Reader[T2, ?], Writer[T4, ?]]]
val e31x24: Eff[R31x24, Unit] = pure(())
e31x24.runT1Writer
type R31x42 = FxAppend[Fx2[Writer[T3, ?], Writer[T1, ?]], Fx2[Writer[T4, ?], Reader[T2, ?]]]
val e31x42: Eff[R31x42, Unit] = pure(())
e31x42.runT1Writer
type R32x14 = FxAppend[Fx2[Writer[T3, ?], Reader[T2, ?]], Fx2[Writer[T1, ?], Writer[T4, ?]]]
val e32x14: Eff[R32x14, Unit] = pure(())
e32x14.runT1Writer
type R32x41 = FxAppend[Fx2[Writer[T3, ?], Reader[T2, ?]], Fx2[Writer[T4, ?], Writer[T1, ?]]]
val e32x41: Eff[R32x41, Unit] = pure(())
e32x41.runT1Writer
type R34x12 = FxAppend[Fx2[Writer[T3, ?], Writer[T4, ?]], Fx2[Writer[T1, ?], Reader[T2, ?]]]
val e34x12: Eff[R34x12, Unit] = pure(())
e34x12.runT1Writer
type R34x21 = FxAppend[Fx2[Writer[T3, ?], Writer[T4, ?]], Fx2[Reader[T2, ?], Writer[T1, ?]]]
val e34x21: Eff[R34x21, Unit] = pure(())
e34x21.runT1Writer
type R41x23 = FxAppend[Fx2[Writer[T4, ?], Writer[T1, ?]], Fx2[Reader[T2, ?], Writer[T3, ?]]]
val e41x23: Eff[R41x23, Unit] = pure(())
e41x23.runT1Writer
type R41x32 = FxAppend[Fx2[Writer[T4, ?], Writer[T1, ?]], Fx2[Writer[T3, ?], Reader[T2, ?]]]
val e41x32: Eff[R41x32, Unit] = pure(())
e41x32.runT1Writer
type R42x13 = FxAppend[Fx2[Writer[T4, ?], Reader[T2, ?]], Fx2[Writer[T1, ?], Writer[T3, ?]]]
val e42x13: Eff[R42x13, Unit] = pure(())
e42x13.runT1Writer
type R42x31 = FxAppend[Fx2[Writer[T4, ?], Reader[T2, ?]], Fx2[Writer[T3, ?], Writer[T1, ?]]]
val e42x31: Eff[R42x31, Unit] = pure(())
e42x31.runT1Writer
type R43x12 = FxAppend[Fx2[Writer[T4, ?], Writer[T3, ?]], Fx2[Writer[T1, ?], Reader[T2, ?]]]
val e43x12: Eff[R43x12, Unit] = pure(())
e43x12.runT1Writer
type R43x21 = FxAppend[Fx2[Writer[T4, ?], Writer[T3, ?]], Fx2[Reader[T2, ?], Writer[T1, ?]]]
val e43x21: Eff[R43x21, Unit] = pure(())
e43x21.runT1Writer
type R123x4 = FxAppend[Fx3[Writer[T1, ?], Reader[T2, ?], Writer[T3, ?]], Fx1[Writer[T4, ?]]]
val e123x4: Eff[R123x4, Unit] = pure(())
e123x4.runT1Writer
type R124x3 = FxAppend[Fx3[Writer[T1, ?], Reader[T2, ?], Writer[T4, ?]], Fx1[Writer[T3, ?]]]
val e124x3: Eff[R124x3, Unit] = pure(())
e124x3.runT1Writer
type R132x4 = FxAppend[Fx3[Writer[T1, ?], Writer[T3, ?], Reader[T2, ?]], Fx1[Writer[T4, ?]]]
val e132x4: Eff[R132x4, Unit] = pure(())
e132x4.runT1Writer
type R134x2 = FxAppend[Fx3[Writer[T1, ?], Writer[T3, ?], Writer[T4, ?]], Fx1[Reader[T2, ?]]]
val e134x2: Eff[R134x2, Unit] = pure(())
e134x2.runT1Writer
type R142x3 = FxAppend[Fx3[Writer[T1, ?], Writer[T4, ?], Reader[T2, ?]], Fx1[Writer[T3, ?]]]
val e142x3: Eff[R142x3, Unit] = pure(())
e142x3.runT1Writer
type R143x2 = FxAppend[Fx3[Writer[T1, ?], Writer[T4, ?], Writer[T3, ?]], Fx1[Reader[T2, ?]]]
val e143x2: Eff[R143x2, Unit] = pure(())
e143x2.runT1Writer
type R213x4 = FxAppend[Fx3[Reader[T2, ?], Writer[T1, ?], Writer[T3, ?]], Fx1[Writer[T4, ?]]]
val e213x4: Eff[R213x4, Unit] = pure(())
e213x4.runT1Writer
type R214x3 = FxAppend[Fx3[Reader[T2, ?], Writer[T1, ?], Writer[T4, ?]], Fx1[Writer[T3, ?]]]
val e214x3: Eff[R214x3, Unit] = pure(())
e214x3.runT1Writer
type R231x4 = FxAppend[Fx3[Reader[T2, ?], Writer[T3, ?], Writer[T1, ?]], Fx1[Writer[T4, ?]]]
val e231x4: Eff[R231x4, Unit] = pure(())
e231x4.runT1Writer
type R234x1 = FxAppend[Fx3[Reader[T2, ?], Writer[T3, ?], Writer[T4, ?]], Fx1[Writer[T1, ?]]]
val e234x1: Eff[R234x1, Unit] = pure(())
e234x1.runT1Writer
type R241x3 = FxAppend[Fx3[Reader[T2, ?], Writer[T4, ?], Writer[T1, ?]], Fx1[Writer[T3, ?]]]
val e241x3: Eff[R241x3, Unit] = pure(())
e241x3.runT1Writer
type R243x1 = FxAppend[Fx3[Reader[T2, ?], Writer[T4, ?], Writer[T3, ?]], Fx1[Writer[T1, ?]]]
val e243x1: Eff[R243x1, Unit] = pure(())
e243x1.runT1Writer
type R312x4 = FxAppend[Fx3[Writer[T3, ?], Writer[T1, ?], Reader[T2, ?]], Fx1[Writer[T4, ?]]]
val e312x4: Eff[R312x4, Unit] = pure(())
e312x4.runT1Writer
type R314x2 = FxAppend[Fx3[Writer[T3, ?], Writer[T1, ?], Writer[T4, ?]], Fx1[Reader[T2, ?]]]
val e314x2: Eff[R314x2, Unit] = pure(())
e314x2.runT1Writer
type R321x4 = FxAppend[Fx3[Writer[T3, ?], Reader[T2, ?], Writer[T1, ?]], Fx1[Writer[T4, ?]]]
val e321x4: Eff[R321x4, Unit] = pure(())
e321x4.runT1Writer
type R324x1 = FxAppend[Fx3[Writer[T3, ?], Reader[T2, ?], Writer[T4, ?]], Fx1[Writer[T1, ?]]]
val e324x1: Eff[R324x1, Unit] = pure(())
e324x1.runT1Writer
type R341x2 = FxAppend[Fx3[Writer[T3, ?], Writer[T4, ?], Writer[T1, ?]], Fx1[Reader[T2, ?]]]
val e341x2: Eff[R341x2, Unit] = pure(())
e341x2.runT1Writer
type R342x1 = FxAppend[Fx3[Writer[T3, ?], Writer[T4, ?], Reader[T2, ?]], Fx1[Writer[T1, ?]]]
val e342x1: Eff[R342x1, Unit] = pure(())
e342x1.runT1Writer
type R412x3 = FxAppend[Fx3[Writer[T4, ?], Writer[T1, ?], Reader[T2, ?]], Fx1[Writer[T3, ?]]]
val e412x3: Eff[R412x3, Unit] = pure(())
e412x3.runT1Writer
type R413x2 = FxAppend[Fx3[Writer[T4, ?], Writer[T1, ?], Writer[T3, ?]], Fx1[Reader[T2, ?]]]
val e413x2: Eff[R413x2, Unit] = pure(())
e413x2.runT1Writer
type R421x3 = FxAppend[Fx3[Writer[T4, ?], Reader[T2, ?], Writer[T1, ?]], Fx1[Writer[T3, ?]]]
val e421x3: Eff[R421x3, Unit] = pure(())
e421x3.runT1Writer
type R423x1 = FxAppend[Fx3[Writer[T4, ?], Reader[T2, ?], Writer[T3, ?]], Fx1[Writer[T1, ?]]]
val e423x1: Eff[R423x1, Unit] = pure(())
e423x1.runT1Writer
type R431x2 = FxAppend[Fx3[Writer[T4, ?], Writer[T3, ?], Writer[T1, ?]], Fx1[Reader[T2, ?]]]
val e431x2: Eff[R431x2, Unit] = pure(())
e431x2.runT1Writer
type R432x1 = FxAppend[Fx3[Writer[T4, ?], Writer[T3, ?], Reader[T2, ?]], Fx1[Writer[T1, ?]]]
val e432x1: Eff[R432x1, Unit] = pure(())
e432x1.runT1Writer
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment