[
  {
    "path": ".gitignore",
    "content": "target/\n\n# vim\n*.sw?\n\n# Ignore [ce]tags files\ntags\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: scala\nscala:\n  - 2.11.7\njdk:\n  - oraclejdk7\n  - oraclejdk8"
  },
  {
    "path": "README.md",
    "content": "# Generalized Effect Composition\n\nOtherwise known as \"less confusing monad transformers\".\n\n**Warning**  The monad produced by `Emm` is *not* guaranteed to be a lawful monad!  In fact, it isn't even guaranteed to be a lawful applicative.  You can see an example of a violation of the applicative laws [here.](https://gitter.im/typelevel/cats?at=5763685752352c840283176a) (much thanks to @TomasMikula!)  I'm leaving this repository up for pedagogical reasons; it's still an interesting exploration of Scala's type system.  But I do *not* recommend you use it for real work, given that the monad is not lawful.\n\n---\n\nThe `Emm` monad provides a syntactically lightweight, type-inference friendly data type for composing effects.  The general motivation is very similar to monad transformers, but the end result is far more user friendly and also significantly more general.  The main goals of the project are as follows:\n\n- Simple and easy to understand\n- Clean type inference\n- Clean type *errors* (dear god, monad transformer compile errors...)\n- Compatibility with pre-existing monads\n\nThese goals are very similar to those which motivated [Oleg's `Eff`](http://okmij.org/ftp/Haskell/extensible/), which is a really terrific data structure.  There are some significant differences though.  Most notably, `Eff` requires effect implementations to be rewritten to be compatible with its internal calculus, and so it does not allow the composition of arbitrary \"standalone\" monads written in a conventional style.  However, `Eff` is able to provide much greater expressive power than `Emm` (or monad transformers) in several key diminsions.  Oleg goes into significant detail on the expressiveness gains of `Eff` in his paper describing the construct.  `Emm` does not provide the same benefits.\n\n## SBT Setup\n\nIf you want to use `Emm` in your project, adding the following SBT configuration will do the trick:\n\n```sbt\nlibraryDependencies += \"com.codecommit\" %% \"emm-core\" % EmmVersion\n```\n\nYou will also need to bring in the appropriate upstream framework support for either Scalaz or Cats, depending on which one you're using.\n\n```sbt\nlibraryDependencies += \"com.codecommit\" %% \"emm-scalaz-71\" % EmmVersion      // for scalaz 7.1\n\n// or!\n\nlibraryDependencies += \"com.codecommit\" %% \"emm-scalaz-72\" % EmmVersion      // for scalaz 7.2\n\n// or!\n\nlibraryDependencies += \"com.codecommit\" %% \"emm-cats\" % EmmVersion        // for cats 0.4.1\n```\n\nYou will want to use either `emm-scalaz` or `emm-cats`.  While there is no technical reason you would not be able to use both in the same project, doing so would be… weird.  At present, Cats support is slightly more complete than Scalaz, but we aim to reach parity soon.\n\nThe most recent stable version of Emm is **0.2.1**.\n\n```sbt\nval EmmVersion = \"0.2.1\"\n```\n\nSnapshot builds are often published as versions derived from the git hash.  For example, `0.2-a21c63a`.  The version prefix indicates *compatibility* with a particular version line, not derivation or antecedence.  Not all git hashes are published, but some are.  When in doubt, try a few.  Or just ask for one to be published.  All artifacts are signed with public key fingerprint [2BAE 5960](https://keybase.io/djspiewak).\n\n## Example\n\n```scala\nimport emm._\nimport emm.compat.scalaz._\n\nimport scalaz.concurrent.Task\nimport scalaz.std.option._\n\ndef readName: Task[String] = ???\ndef log(msg: String): Task[Unit] = ???\n\ntype E = Task |: Option |: Base\n\nval effect: Emm[E, String] = for {\n  first <- readName.liftM[E]\n  last <- readName.liftM[E]\n\n  name <- (if ((first.length * last.length) < 20) Some(s\"$first $last\") else None).liftM[E]\n\n  _ <- log(s\"successfully read in $name\").liftM[E]\n} yield name\n```\n\nThe above is analogous to monad transformers in many ways.  In fact, we can write the exact same code from above using `OptionT`:\n\n```scala\nimport scalaz._\nimport scalaz.concurrent.Task\nimport scalaz.syntax.monad._\n\ndef readName: Task[String] = ???\ndef log(msg: String): Task[Unit] = ???\n\nval effect: OptionT[Task, String] = for {\n  first <- readName.liftM[OptionT]\n  last <- readName.liftM[OptionT]\n\n  name <- (if ((first.length * last.length) < 20) OptionT.some[Task, String](s\"$first $last\") else OptionT.none[Task, String])\n\n  _ <- log(s\"successfully read in $name\").liftM[OptionT]\n} yield name\n```\n\nThe advantages of `Emm` become much more apparent when attempting to stack more than just two monads simultaneously.  For example, one might imagine stacking `Task`, `Option` and right-biased `Either`.  Let's enrich our previous example with some error handling (note that I'm using [kind projector](https://github.com/non/kind-projector) to avoid type lambdas):\n\n```scala\nimport emm._\nimport emm.compat.scalaz._\n\nimport scalaz._\nimport scalaz.concurrent.Task\nimport scalaz.std.option._\n\ndef readName: Task[String] = ???\ndef log(msg: String): Task[Unit] = ???\n\ntype E = Task |: (String \\/ ?) |: Option |: Base\n\nval effect: Emm[E, String] = for {\n  first <- readName.liftM[E]\n  last <- readName.liftM[E]\n\n  name <- (if ((first.length * last.length) < 20) Some(s\"$first $last\") else None).liftM[E]\n\n  _ <- (if (name == \"Daniel Spiewak\") -\\/(\"your kind isn't welcome here\") else \\/-(())).liftM[E]\n\n  _ <- log(s\"successfully read in $name\").liftM[E]\n} yield name\n```\n\nIt works as expected, with all the same syntax as before. However, if we look at the same example using monad transformers, a rather distopian picture emerges:\n\n```scala\nimport scalaz._\nimport scalaz.concurrent.Task\nimport scalaz.syntax.monad._\n\ndef readName: Task[String] = ???\ndef log(msg: String): Task[Unit] = ???\n\nval effect: OptionT[EitherT[Task, String, ?], String] = for {\n  first <- readName.liftM[EitherT[?[_], String, ?]].liftM[OptionT]\n  last <- readName.liftM[(EitherT[?[_], String, ?]].liftM[OptionT]\n\n  name <- if ((first.length * last.length) < 20)\n    OptionT.some[EitherT[Task, String, ?], String](s\"$first $last\")\n  else\n    OptionT.none[EitherT[Task, String, ?], String]\n\n  _ <- (if (name == \"Daniel Spiewak\")\n    EitherT.fromDisjunction[Task](\\/.left[String, Unit](\"your kind isn't welcome here\"))\n  else\n    EitherT.fromDisjunction[Task](\\/.right[String, Unit](()))).liftM[OptionT]\n\n  _ <- log(s\"successfully read in $name\").liftM[EitherT[?[_], String, ?]].liftM[OptionT]\n} yield name\n```\n\nThat's a *lot* of very explicit lifting and special syntax.  I had to ponder quite long and hard about the above, and I'm not even sure if I got it all right!  Monad transformers are very ugly, very cumbersome, and when you get things wrong they explode in remarkably spectacular ways.\n\nThe `Emm` monad is intended to change all of that.  It is intended to be very straightforward to manage and extend complex stacks of effects, and to do so without any special wrappers or added complexity from the effect author.  No need to write an `OptionT`, just use `Option`!\n\n## API\n\nThe following API is provided.  For starters, the following pair of functions are implicitly provided to lift values into the effect stack:\n\n- `pointM[C <: Effects]` – Points a value of type `A` into the monad, `Emm[C, A]`.  Requires an `Applicative` for each component of the effect stack `C`.\n- `liftM[C <: Effects]` – Given an effect which is of a type contained within `C`, lift the effect into the full effect stack represented by `C`.  For example: `Option(42).liftM[Task |: Option |: Base]`\n- `wrapM[C <: Effects]` – Given a full stack of effects which matches the stack `C`, wrap the stack in the `Emm` monad.  Note that the `C` parameter can be inferred basically 100% of the time, but can be provided explicitly to assert correctness.  Example: `(Task now Option(42)).wrapM`.  This is equivalent to calling the `Emm(...)` constructor, but the type inference is much nicer.\n\nThese methods are exposed via implicit classes contained within the `emm` package object.  All of the above methods are aliased on the `Emm` object as `point`, `lift` and `wrap`, respectively.  You'll notice, however, that they do require a bit of extra type annotation since the target type and the effect stack are in the same type block, rather than separate ones (as in the case of implicitly provided members).  Thus, you should generally prefer the \"`M` versions\" of each method wherever possible (i.e. when not importing `scalaz.syntax.monad._`).\n\nThe `Emm` monad itself provides the following (effective) API:\n\n- `map[B](A => B): Emm[C, B]` – Conventional functor map.  Transforms the value within the effect\n- `flatMap[B](A => Emm[C, B]): Emm[C, B]` – Monadic bind.  Transforms the value within the effect and joins the two effect stacks.  This function requires that all components of `C` define a `bind` function, and all components aside from the outer-most (left-most) must have a `Traverse` instance.\n- `flatMapM[G[_], B](A => G[B]): Emm[C, B]` – Similar to `flatMap`, except instead of transforming the value to an effect contained within the entire effect stack, `C`, it transforms the value to a single component of that effect stack.  Thus, `G` must be in `C`.  The result is joined with the effect stack and returned within `Emm`.\n- `expand` – The inverse of `collapse`.  Converts an `Emm` of the form `Emm[... |: F |: Base, A]` into `Emm[... |: Base, F[A]]`.  This is extremely useful when there are effect-specific functions (e.g. `Option#getOrElse`) that you need to access on the inner-most (right-most) effect of the stack.  Once you have expanded, you can use `map` or `flatMap` to access these functions and manipulate the inner-most effect.  Runs in constant time.\n- `collapse` – The inverse of `expand`.  Converts an `Emm` of the form `Emm[... |: Base, F[A]]` into `Emm[... |: F |: Base, A]`.  This is generally most useful in conjunction with `expand`, where you have manipulated the inner-most effect and you need to \"recombine\" the results of that manipulation with the full effect stack.  Runs in constant time.\n- `run` – Unwraps the effect stack (without modification) from `Emm`.  Effectively, this takes a type of the form `Emm[F |: G |: Base, A]` and produces a type of the form `F[G[A]]`.  Literally, it is the \"contents\" of `Emm`.\n\n## Requirements\n\nRight now, this is sitting on top of the [shims](https://github.com/djspiewak/shims) 0.2 typeclass hierarchy, which is to say that it supports Cats 0.3, Scalaz 7.2 and 7.1.  Everything is implemented in terms of the following type classes (with minimal constraints for every function):\n\n- `Applicative`\n- `FlatMap`\n- `Functor`\n- `Traverse`\n\n### Invalid and Partially-Valid Stacks\n\nConstraints which are not required to evaluate a given function are not assumed.  For example, consider the following effect stack:\n\n```scala\ntype E = Option |: Task |: Base\n\nval effect = Option(42).liftM[E]\n```\n\nIf you attempt to run `flatMap` on this effect stack, you will run into problems:\n\n```scala\neffect flatMapM { i => if (i < 20) None else Some(i * 2) }          // does not compile!\n```\n\nThis will fail because `Task` is *not* the outer-most effect, which is to say, it isn't the effect on the far left of the effect definition.  The reason this is a problem becomes more clear if we look at things in terms of `map`, `flatten` and the raw stack, rather than simply `flatMap` and the collapsed `Emm` monad:\n\n```scala\nval effect2: Option[Task[Int]] = Some(Task now 42)\n\nval mapped: Option[Task[Option[Task[Int]]]] = effect2 map { t =>\n  t map { i =>\n    if (i < 20) None else Some(Task now (i * 2))\n  }\n}\n\nval result: Option[Task[Int]] = mapped.flatten    // ??????\n```\n\nNotice the problem here.  We need to take the second `Option` layer, which is *within* a `Task`, and \"flip\" it outside of the `Task` layer in order to flatten the `Option` and `Task` layers together.  Basically, we want to do something like this:\n\n```scala\nOption[Task[Option[Task[Int]]]] => Option[Option[Task[Task[Int]]]] => Option[Task[Task[Int]]] => Option[Task[Int]]\n```\n\nClearly, there are no problems with the last two stages, but that second stage is completely impossible.  We can't take a value from inside `Task` and \"flip\" it to the outside.  `Task` is basically a `Future`, so the value \"inside\" of `Task` doesn't even exist yet!  So this effect stack is non-sensical as a monad; we cannot define `flatMap` (or equivalently, `flatMapM`) on it, and the compiler is very happy to tell us so.\n\nTechnically, the reason we *can't* do this is because there is no instance `Traverse[Task]`, and in fact you cannot define such an instance without actually running the `Task`.  Our example from earlier though, where our stack was `Task |: Option |: Base` was just fine, because there *is* an instance `Traverse[Option]`.\n\nHere's the cool bit though.  Even though it doesn't make any sense to define `flatMap` on `Emm[Option |: Task |: Base, Int]`, there's no reason why we can't define `map`!\n\n```scala\ntype E = Option |: Task |: Base\n\nval effect = Option(42).liftM[E]\n\nval effect2 = effect map { _ * 2 }          // no problemo!\n```\n\nEven though our effect stack is sort of bogus, it's only bogus if we attempt to treat it *as a monad*.  It's a perfectly valid applicative functor, and we can treat it as such.  In other words, `flatMap` doesn't work (and shouldn't work!) on some effect stacks, but `map` works on any effect stack where each component effect has a `Functor`.\n\n## Limitations\n\nMaybe this section should be nearer to the top...  Oh well.\n\nThe most significant limitation of this approach is caused by everyone's favorite limitation of the scalac type checker, [SI-2712](https://issues.scala-lang.org/browse/SI-2712).  The good news is that this bug is not a complete show stopper; it's relatively easy to work around when you control the entire stack of type signatures (as I do here) and you're not trying to generalize over different type constructor arities.  The bad news is that it makes my life very difficult, and it imposes some pretty hard limits (also related to how much boilerplate I'm willing to type out) on what sorts of type constructors do and do not work with `Emm`.\n\nSpecifically, the following *kinds* of type constructors are accepted (i.e. will be fully functional in any position of an effect stack):\n\n- `* -> *` – Examples: `Option`, `List`, `Task`\n- `* x * -> *` – Examples: `Either`, `State` (with caveats), `Writer` (more caveats), `Reader` (sorry, still caveated)\n- `* x * x * -> *` – Examples: *No idea*\n- `(* -> *) x * -> *` – Examples: `Free`, `OptionT`, `ListT`, `StreamT`\n- `(* -> *) x * x * -> *` – Examples: *uh...*\n- `(* -> *) x * x * x * -> *` – Examples: `IndexedStateT` (sort of)\n"
  },
  {
    "path": "build.sbt",
    "content": "lazy val commonSettings = Seq(\n  organization := \"com.codecommit\",\n\n  licenses += (\"Apache-2.0\", url(\"http://www.apache.org/licenses/\")),\n\n  scalaVersion := \"2.11.7\",\n\n  crossScalaVersions := Seq(scalaVersion.value),\n\n  shimsVersion := \"0.3\",\n\n  libraryDependencies += \"org.specs2\" %% \"specs2-core\" % \"3.7\" % \"test\",\n\n  addCompilerPlugin(\"org.spire-math\" % \"kind-projector\" % \"0.7.1\" cross CrossVersion.binary),\n\n  scalacOptions += \"-language:_\",      // I really can't be bothered with SIP-18\n  scalacOptions += \"-Ybackend:GenBCode\",\n\n  // scalacOptions += \"-Xlog-implicits\",\n\n  scalacOptions in Test += \"-Yrangepos\",\n\n  isSnapshot := version.value endsWith \"SNAPSHOT\",      // so… sonatype doesn't like git hash snapshots\n\n  publishMavenStyle := true,\n  pomIncludeRepository := { _ => false },\n\n  sonatypeProfileName := \"com.codecommit\",\n\n  pomExtra :=\n    <developers>\n      <developer>\n        <id>djspiewak</id>\n        <name>Daniel Spiewak</name>\n        <url>http://www.codecommit.com</url>\n      </developer>\n      <developer>\n        <id>alissapajer</id>\n        <name>Alissa Pajer</name>\n      </developer>\n    </developers>,\n\n  homepage := Some(url(\"https://github.com/djspiewak/emm\")),\n\n  scmInfo := Some(ScmInfo(url(\"https://github.com/djspiewak/emm\"),\n    \"git@github.com:djspiewak/emm.git\")))\n\nlazy val root = project.in(file(\".\")).settings(commonSettings: _*).aggregate(core, cats, scalaz71, scalaz72).settings(\n  name := \"emm\",\n\n  publish := (),\n  publishLocal := (),\n  publishArtifact := false)\n\nlazy val core = project.in(file(\"core\")).settings(commonSettings: _*)\nlazy val cats = project.in(file(\"cats\")).settings(commonSettings: _*).dependsOn(core)\n\nlazy val scalaz72 = project.in(file(\"scalaz72\")).settings(commonSettings: _*).dependsOn(core)\nlazy val scalaz71 = project.in(file(\"scalaz71\")).settings(commonSettings: _*).dependsOn(core)\n\nenablePlugins(GitVersioning)\n\nval ReleaseTag = \"\"\"^v([\\d\\.]+)$\"\"\".r\n\ngit.baseVersion := \"0.2\"\n\ngit.gitTagToVersionNumber := {\n  case ReleaseTag(version) => Some(version)\n  case _ => None\n}\n\ngit.formattedShaVersion := {\n  val suffix = git.makeUncommittedSignifierSuffix(git.gitUncommittedChanges.value, git.uncommittedSignifier.value)\n\n  git.gitHeadCommit.value map { _.substring(0, 7) } map { sha =>\n    git.baseVersion.value + \"-\" + sha + suffix\n  }\n}\n\ngit.gitUncommittedChanges := \"git status -s\".!!.trim.length > 0\n"
  },
  {
    "path": "cats/build.sbt",
    "content": "name := \"emm-cats\"\n\nlibraryDependencies ++= Seq(\n  \"com.codecommit\" %% \"shims-cats\"  % shimsVersion.value,\n\n  \"org.scalaz\"     %% \"scalaz-core\" % \"7.1.6\" % \"test\")\n"
  },
  {
    "path": "cats/src/main/scala/emm/compat/cats.scala",
    "content": "package emm\npackage compat\n\nimport effects._\nimport properties._\n\nimport _root_.cats.~>\nimport _root_.cats.data.Kleisli\n\nprivate[emm] object Shared {\n\n  implicit def functor[F <: Effects](implicit F: Mapper[F]): _root_.cats.Functor[F#Point] = new _root_.cats.Functor[F#Point] {\n    def map[A, B](fa: F#Point[A])(f: A => B): F#Point[B] = F.map(fa)(f)\n  }\n\n  implicit def monad[F <: Effects](implicit FM: Mapper[F], FB: Binder[F]): _root_.cats.Monad[F#Point] = new _root_.cats.Monad[F#Point] {\n    def pure[A](a: A) = FM.point(a)\n    override def map[A, B](fa: F#Point[A])(f: A => B): F#Point[B] = FM.map(fa)(f)\n    def flatMap[A, B](fa: F#Point[A])(f: A => F#Point[B]): F#Point[B] = FB.bind(fa)(f)\n  }\n}\n\nprivate[emm] trait BinderShims {\n\n  implicit def pivotKleisliBinder[Z, C <: Effects, F <: Effects, T <: Effects](implicit NAP: NestedAtPoint[C, Kleisli[?[_], Z, ?], F, T], FB: Binder[F], FM: Mapper[F], TB: Binder[T], TT: Traverser[T]): Binder[C] = new Binder[C] {\n    import Shared.monad\n\n    def bind[A, B](fca: CC[A])(f: A => CC[B]): CC[B] = {\n      val back = NAP.unpack(fca) flatMap { ca =>\n        val ptta = TT.traverse[Kleisli[F#Point, Z, ?], A, T#Point[B]](ca)({ a => NAP.unpack(f(a)) })(shims.cats.applicative1[Kleisli[F#Point, Z, ?]](Kleisli.kleisliApplicative[F#Point, Z]))\n\n        ptta map { tta => TB.bind(tta) { a => a } }\n      }\n\n      NAP.pack(back)\n    }\n  }\n}\n\nprivate[emm] trait LifterShims {\n\n  implicit def midKleisli[A, Z, C <: Effects, F <: Effects, T <: Effects](implicit NAP: NestedAtPoint[C, Kleisli[?[_], Z, ?], F, T], F: Mapper[F], T: Mapper[T]): Lifter.Aux[Kleisli[λ[X => X], Z, A], C, A] = new Lifter[Kleisli[λ[X => X], Z, A], C] {\n    type Out = A\n\n    import Shared.functor\n\n    def apply(e: Kleisli[λ[X => X], Z, A]): CC[Out] = {\n      val t = new (λ[X => X] ~> F#Point) {\n        def apply[A](a: A): F#Point[A] = F.point(a)\n      }\n\n      NAP.pack(e.transform[F#Point](t) map T.point)\n    }\n  }\n\n  implicit def leftPivotKleisli[E, Z, C <: Effects, F <: Effects, T <: Effects](implicit NAP: NestedAtPoint[C, Kleisli[?[_], Z, ?], F, T], T: Mapper[T], F: Lifter[E, F], FM: Mapper[F]): Lifter.Aux[E, C, F.Out] = new Lifter[E, C] {\n    type Out = F.Out\n\n    def apply(e: E): CC[Out] =\n      NAP.pack(Kleisli[F#Point, Z, T#Point[F.Out]]({ _ => FM.map(F(e)) { a => T.point(a) } }))\n  }\n\n  implicit def rightPivotKleisli[E, Z, C <: Effects, F <: Effects, T <: Effects](implicit NAP: NestedAtPoint[C, Kleisli[?[_], Z, ?], F, T], T: Lifter[E, T], F: Mapper[F]): Lifter.Aux[E, C, T.Out] = new Lifter[E, C] {\n    type Out = T.Out\n\n    def apply(e: E): CC[Out] = NAP.pack(Kleisli[F#Point, Z, T#Point[T.Out]] { _ => F.point(T(e)) })\n  }\n}\n\nprivate[emm] trait MapperShims {\n\n  // we require a Binder[F] because we cannot derive a consistent Applicative from Mapper[F]\n  implicit def pivotKleisliMapper[Z, C <: Effects, F <: Effects, T <: Effects](implicit NAP: NestedAtPoint[C, Kleisli[?[_], Z, ?], F, T], FB: Binder[F], FM: Mapper[F], T: Mapper[T]): Mapper[C] = new Mapper[C] {\n    import Shared.monad\n\n    def point[A](a: A): CC[A] = NAP.pack(Kleisli.pure[F#Point, Z, T#Point[A]](T.point(a)))\n\n    def map[A, B](fa: CC[A])(f: A => B): CC[B] =\n      NAP.pack(NAP.unpack(fa) map { ta => T.map(ta)(f) })\n  }\n}\n\nobject cats extends shims.Implicits with BinderShims with LifterShims with MapperShims"
  },
  {
    "path": "cats/src/test/scala/emm/ApplicativeSpecs.scala",
    "content": "package emm\n\nimport org.specs2.mutable._\n\nimport cats._\nimport cats.std.list._\nimport cats.std.option._\n\n/*object ApplicativeSpecs extends Specification {\n  \"derived applicative\" should {\n    \"be consistent with bind in Option |: List\" in {\n      type E = Option |: List |: Base\n\n      val a = Emm[E, Int](None)\n      val b = Emm[E, Int => Int](Some(Nil))\n\n      // swap the following two blocks and the test will fail\n\n      // val A = Emm.applicativeInstance[E]\n      // val M = Emm.monadInstance[E]\n\n      val A = Applicative[Emm[E, ?]]\n      val M = Monad[Emm[E, ?]]\n\n      A.ap(a)(b) mustEqual (M.flatMap(b) { b => M.map(a)(b) })\n      M.ap(a)(b) mustEqual (M.flatMap(b) { b => M.map(a)(b) })\n    }\n  }\n}*/\n"
  },
  {
    "path": "cats/src/test/scala/emm/BinderSpecs.scala",
    "content": "package emm\n\nimport emm.compat.cats._\n\nimport org.specs2.mutable._\n\nimport cats._\nimport cats.data._\nimport cats.free.Free\nimport cats.std.list._\nimport cats.std.option._\nimport cats.std.function._\n\nimport scalaz.concurrent.Task\n\nobject BinderSpecs extends Specification with TestHelpers {\n\n  \"simple effect composition with binder\" should {\n\n    \"allow binding\" in {\n      type E = List |: Option |: Base\n\n      val e = for {\n        v <- List(1, 2, 3, 4).liftM[E]\n        v2 <- (Some(v) filter { _ % 2 == 0 }).liftM[E]\n      } yield v2\n\n      e mustEqual Emm[E, Int](List(None, Some(2), None, Some(4)))\n    }\n\n    \"allow binding over a Option of Kleisli of List\" in {\n      type E = Option |: Kleisli[?[_], Int, ?] -|: List |: Base\n\n      import effects._\n      import properties._\n\n      \"foobar\".pointM[E].flatMap(x => (x + \"baz\").pointM[E]).run.run(42) mustEqual Some(List(\"foobarbaz\"))\n    }\n\n    \"allow binding over a Option of List of Kleisli\" in {\n      type E = Option |: List |: Kleisli[?[_], Int, ?] -|: Base\n\n      \"foobar\".pointM[E].flatMap(x => (x + \"baz\").pointM[E]).run.run(42) mustEqual Some(List(\"foobarbaz\"))\n    }\n\n    \"bind over a stack that contains a partially-applied arity-2 constructor\" in {\n      type E = (String Xor ?) |: Base\n\n      42.pointM[E] flatMap { _ => \"foo\".pointM[E] } mustEqual Emm[E, String](Xor.right(\"foo\"))\n    }\n\n    \"bind over a stack that contains a partially-applied arity-2 higher-order constructor\" in {\n      \"base\" >> {\n        type E = Free[List, ?] |: Base\n\n        (42.pointM[E] flatMap { _ => \"foo\".pointM[E] } run).runM(identity) mustEqual List(\"foo\")\n      }\n\n      \"inner\" >> {\n        type E = Option |: Free[List, ?] |: Base\n\n        (42.pointM[E] flatMap { _ => \"foo\".pointM[E] } run) must beLike {\n          case Some(f) => f.runM(identity) mustEqual List(\"foo\")\n        }\n      }\n\n      \"outer\" >> {\n        type E = Free[List, ?] |: Option |: Base\n\n        (42.pointM[E] flatMap { _ => \"foo\".pointM[E] } run).runM(identity) mustEqual List(Option(\"foo\"))\n      }\n    }\n\n    \"bind over a stack that contains state\" in {\n      \"inner\" >> {\n        type E = Option |: StateT[?[_], String, ?] -|: Base\n\n         (42.pointM[E] flatMap { _ => \"foo\".pointM[E] }).run.runA(\"blah\") must beSome(\"foo\")\n       }\n\n       \"mid\" >> {\n         type E = List |: StateT[?[_], String, ?] -|: Option |: Base\n\n         (42.pointM[E] flatMap { _ => \"foo\".pointM[E] }).run.runA(\"blah\") mustEqual List(Some(\"foo\"))\n      }\n    }\n\n    \"enable flatMapM in any direction\" in {\n      type E = List |: Option |: Base\n\n      val e1 = List(1, 2, 3, 4).liftM[E]\n      val e2 = e1 flatMapM { v => Some(v) filter { _ % 2 == 0 } }\n      val e3 = e2 flatMapM { v => List(v, v) }\n\n      e3 mustEqual Emm[E, Int](List(None, Some(2), Some(2), None, Some(4), Some(4)))\n    }\n\n    \"allow flatMapM on a stack containing an arity-2 constructor\" in {\n      type E = List |: (String Xor ?) |: Base\n\n      val e1 = List(1, 2, 3, 4).liftM[E]\n      val e2 = e1 flatMapM { v => if (v % 2 == 0) Xor.right(v) else Xor.left(\"that's... odd\") }\n      val e3 = e2 flatMapM { v => List(v, v) }\n\n      e3 mustEqual Emm[E, Int](List(Xor.left(\"that's... odd\"), Xor.right(2), Xor.right(2), Xor.left(\"that's... odd\"), Xor.right(4), Xor.right(4)))\n    }\n\n    \"allow flatMapM on a stack containing a higher-order arity-2 constructor\" in {\n      type E = List |: Free[Option, ?] |: Base\n\n      val e1 = List(1, 2, 3, 4).liftM[E]\n      val e2 = e1 flatMapM { v => if (v % 2 == 0) Free.pure[Option, Int](v) else Free.liftF[Option, Int](None) }\n      val e3 = e2 flatMapM { v => List(v, v) }\n\n      e3.run must beLike {\n        case List(f1, f2, f3, f4, f5, f6) => {\n          f1.runM(identity) mustEqual None\n          f2.runM(identity) mustEqual Some(2)\n          f3.runM(identity) mustEqual Some(2)\n          f4.runM(identity) mustEqual None\n          f5.runM(identity) mustEqual Some(4)\n          f6.runM(identity) mustEqual Some(4)\n        }\n      }\n    }\n  }\n\n  \"non-traversable effect composition with binder\" should {\n\n    \"allow binding where the non-traversable effect is outermost\" in {\n      type E = Task |: Option |: Base\n      val opt: Option[Int] = Some(42)\n\n      var sink = 0\n\n      val e = for {\n        i <- opt.liftM[E]\n        _ <- (Task delay { sink += i }).liftM[E]\n      } yield ()\n\n      e.run.run\n\n      sink mustEqual 42\n    }\n  }\n}\n"
  },
  {
    "path": "cats/src/test/scala/emm/ExpanderCollapserSpecs.scala",
    "content": "package emm\n\nimport emm.compat.cats._\n\nimport org.specs2.mutable._\n\nimport cats._\nimport cats.data._\nimport cats.free.Free\nimport cats.std.list._\nimport cats.std.option._\nimport cats.std.function._\n\nimport scalaz.concurrent.Task\nimport scalaz.\\/-\n\nobject ExpanderCollapserSpecs extends Specification with TestHelpers {\n\n  \"basic simple effect composition\" should {\n\n    \"define pointM\" in {\n      42.pointM[Option |: List |: Base] mustEqual Emm[Option |: List |: Base, Int](Option(List(42)))\n    }\n  }\n\n  \"non-traversable effect composition with expander and collapser\" should {\n\n    \"enable access to the base of the stack\" in {\n      type E = Task |: Option |: Base\n      val opt: Option[Int] = None\n\n      // this type infers better than a single function\n      val e = opt.liftM[E].expand map { _ getOrElse 12 }\n\n      e.run.run mustEqual 12\n    }\n\n    \"allow both expansion and collapse of base\" in {\n      type E = Task |: Option |: Base\n      val opt: Option[Int] = None\n\n      // this type infers better than a single function\n      val e = opt.liftM[E].expand map { _ orElse Some(24) } collapse\n\n      e.run.run must beSome(24)\n    }\n\n    \"allow both expansion and collapse of base with an arity-2 constructor\" in {\n      \"inner\" >> {\n        type E = Task |: (String Xor ?) |: Base\n\n        val e = (Task now 42).liftM[E].expand map { _.swap } collapse\n\n        e.run.run mustEqual Xor.left(42)\n      }\n\n      \"outer\" >> {\n        type E = (String Xor ?) |: Task |: Base\n\n        val e = (Task now 42).liftM[E].expand map { _.attempt } collapse\n\n        e.run must beLike {\n          case Xor.Right(t) => t.run mustEqual \\/-(42)\n        }\n      }\n    }\n\n    \"allow both expansion and collapse of base with a higher-order arity-2 constructor\" in {\n      val toList = new (Option ~> List) {\n        def apply[A](xs: Option[A]) = xs.toList\n      }\n\n      \"inner\" >> {\n        type E = Task |: Free[Option, ?] |: Base\n\n        val e = (Task now 42).liftM[E].expand map { _ mapSuspension toList } collapse\n\n        e.run.run.runM(identity) mustEqual List(42)\n      }\n\n      \"outer\" >> {\n        type E = Free[Option, ?] |: Task |: Base\n\n        val e = (Task now 42).liftM[E].expand map { _.attempt } collapse\n\n        e.run.runM(identity) must beLike {\n          case Some(t) => t.run mustEqual \\/-(42)\n        }\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "cats/src/test/scala/emm/FutureSpecs.scala",
    "content": "package emm\n\nimport emm.compat.cats._\n\nimport org.specs2.mutable._\n\nimport cats.std.list._\nimport cats.std.option._\nimport cats.std.future._\n\nimport scala.concurrent.{Await, Future}\nimport scala.concurrent.duration._\n\nobject FutureSpecs extends Specification {\n  implicit val ec = scala.concurrent.ExecutionContext.global\n\n  \"emm with future\" should {\n    \"compose with list and option\" in {\n      type E = Future |: Option |: List |: Base\n\n      val bam = for {\n        f <- Future(3).liftM[E]\n        o <- Option(2).liftM[E]\n        l <- List(1, 1).liftM[E]\n      } yield f + o + l\n\n      Await.result(bam.run, 20 seconds) must beSome(List(6, 6))\n    }\n  }\n}\n"
  },
  {
    "path": "cats/src/test/scala/emm/LifterSpecs.scala",
    "content": "package emm\n\nimport emm.compat.cats._\n\nimport org.specs2.mutable._\n\nimport cats._\nimport cats.data._\nimport cats.std.list._\nimport cats.std.option._\nimport cats.free.Free\n\nimport scalaz.concurrent.Task\n\nobject LifterSpecs extends Specification with TestHelpers {\n\n  \"simple effect composition with lifter\" should {\n\n    \"allow lifting in either direction\" in {\n      val opt: Option[Int] = Some(42)\n\n      opt.liftM[Option |: List |: Base] must haveType[Emm[Option |: List |: Base, Int]].attempt\n      opt.liftM[List |: Option |: Base] must haveType[Emm[List |: Option |: Base, Int]].attempt\n    }\n\n    \"lift into an effect stack of depth three\" in {\n      type E = Task |: List |: Option |: Base\n\n      Option(42).liftM[E].run.run mustEqual List(Option(42))\n      List(42).liftM[E].run.run mustEqual List(Option(42))\n      (Task now 42).liftM[E].run.run mustEqual List(Option(42))\n    }\n\n    \"lift into a stack that contains a partially-applied arity-2 constructor\" in {\n      \"inner\" >> {\n        type E = Option |: (String Xor ?) |: Base\n\n        Xor.right[String, Int](42).liftM[E] mustEqual Emm[E, Int](Option(Xor.right(42)))\n        Xor.left[String, Int](\"fuuuuuu\").liftM[E] mustEqual Emm[E, Int](Option(Xor.left(\"fuuuuuu\")))\n      }\n\n      \"outer\" >> {\n        type E = (String Xor ?) |: Option |: Base\n\n        Xor.right[String, Int](42).liftM[E] mustEqual Emm[E, Int](Xor.right(Option(42)))\n        Xor.left[String, Int](\"fuuuuuu\").liftM[E] mustEqual Emm[E, Int](Xor.left(\"fuuuuuu\"))\n      }\n    }\n\n    \"lift into a stack that contains a partially-applied arity-2 higher-order constructor\" in {\n      \"inner\" >> {\n        type E = Option |: Free[List, ?] |: Base\n\n        Free.pure[List, Int](42).liftM[E].run must beLike {\n          case Some(f) => f runM identity mustEqual List(42)\n        }\n\n        Option(42).liftM[E].run must beLike {\n          case Some(f) => f runM identity mustEqual List(42)\n        }\n      }\n\n      \"outer\" >> {\n        type E = Free[List, ?] |: Option |: Base\n\n        Free.pure[List, Int](42).liftM[E].run.runM(identity) mustEqual List(Option(42))\n        Option(42).liftM[E].run.runM(identity) mustEqual List(Option(42))\n      }\n    }\n\n    \"lift into a stack that contains a partially-applied arity-2 higher-order constructor and an arity-2 constructor\" in {\n      \"inner\" >> {\n        type E = (String Xor ?) |: Free[List, ?] |: Base\n\n        Free.pure[List, Int](42).liftM[E].run must beLike {\n          case Xor.Right(f) => f runM identity mustEqual List(42)\n        }\n\n        Xor.right[String, Int](42).liftM[E].run must beLike {\n          case Xor.Right(f) => f runM identity mustEqual List(42)\n        }\n      }\n\n      \"outer\" >> {\n        type E = Free[List, ?] |: (String Xor ?) |: Base\n\n        Free.pure[List, Int](42).liftM[E].run.runM(identity) mustEqual List(Xor.right(42))\n        Xor.right[String, Int](42).liftM[E].run.runM(identity) mustEqual List(Xor.right(42))\n      }\n    }\n\n    \"lift into a stack that contains a kleisli\" in {\n      import cats.data.Kleisli\n\n      \"inner\" >> {\n        type E = Option |: Kleisli[?[_], String, ?] -|: Base\n\n        Kleisli.pure[λ[X => X], String, Int](12).liftM[E].run.run(\"foo\") must beSome(12)\n        Option(42).liftM[E].run.run(\"foo\") must beSome(42)\n      }\n\n      \"outer\" >> {\n        type E = Free[List, ?] |: Option |: Base\n\n        Free.pure[List, Int](42).liftM[E].run.runM(identity) mustEqual List(Option(42))\n        Option(42).liftM[E].run.runM(identity) mustEqual List(Option(42))\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "cats/src/test/scala/emm/MapperSpecs.scala",
    "content": "package emm\n\nimport emm.compat.cats._\n\nimport org.specs2.mutable._\n\nimport cats._\nimport cats.data._\nimport cats.std.list._\nimport cats.std.option._\n\nimport scalaz.concurrent.Task\n\nobject MapperSpecs extends Specification with TestHelpers {\n\n  \"simple effect composition with mapper\" should {\n\n    \"allow mapping\" in {\n      val opt: Option[Int] = Some(42)\n      val e = opt.liftM[List |: Option |: Base]\n\n      e map (2 *) mustEqual Emm[List |: Option |: Base, Int](List(Some(84)))\n    }\n\n    \"allow mapping over a Kleisli\" in {\n      type E = Option |: Kleisli[?[_], Int, ?] -|: Base\n\n      \"foobar\".pointM[E].map(_ + \"baz\").run.run(42) must beSome(\"foobarbaz\")\n    }\n\n    \"allow mapping over a List of Option of Kleisli\" in {\n      type E = List |: Option |: Kleisli[?[_], Int, ?] -|: Base\n\n      \"foobar\".pointM[E].map(_ + \"baz\").run.run(42) mustEqual List(Some(\"foobarbaz\"))\n    }\n\n    \"allow mapping over a Option of Kleisli of List\" in {\n      type E = Option |: Kleisli[?[_], Int, ?] -|: List |: Base\n\n      \"foobar\".pointM[E].map(_ + \"baz\").run.run(42) mustEqual Some(List(\"foobarbaz\"))\n    }\n  }\n\n  \"non-traversable effect composition with mapper\" should {\n\n    \"allow mapping in either direction\" in {\n      val opt: Option[Int] = Some(42)\n\n      opt.liftM[Task |: Option |: Base] map (2 *)\n      opt.liftM[Option |: Task |: Base] map (2 *)\n\n      ok\n    }\n  }\n}\n"
  },
  {
    "path": "cats/src/test/scala/emm/TestHelpers.scala",
    "content": "package emm\n\nimport org.specs2.matcher._\n\nimport cats._\nimport cats.data._\nimport cats.free.Free\n\nimport scalaz.concurrent.Task\n\nimport scala.reflect.runtime.universe.TypeTag\n\n\ntrait TestHelpers {\n\n  def haveType[A](implicit A: TypeTag[A]) = new {\n\n    def attempt[B](implicit B: TypeTag[B]): Matcher[B] = new Matcher[B] {\n      def apply[B2 <: B](s: Expectable[B2]) =\n        result(A.tpe =:= B.tpe, s\"${s.description} has type ${A.tpe}\", s\"${s.description} does not have type ${A.tpe}; has type ${B.tpe}\", s)\n    }\n  }\n\n  implicit val taskFlatMap: Monad[Task] = new Monad[Task] {\n    import scalaz.concurrent.Future\n\n    def pure[A](x: A): Task[A] = new Task(Future.delay(Task.Try(x)))\n\n    def flatMap[A, B](fa: Task[A])(f: A => Task[B]): Task[B] = {\n      fa.flatMap(f)\n    }\n  }\n\n  implicit def freeTraverse[F[_]](implicit trF: Traverse[F]): Traverse[Free[F, ?]] = new Traverse[Free[F, ?]] {\n\n    def traverse[G[_], A, B](fa: Free[F, A])(f: A => G[B])(implicit ap: Applicative[G]): G[Free[F, B]] =\n      fa.resume match {\n        case Xor.Left(s) => ap.map(trF.traverse(s)(fa => traverse[G, A ,B](fa)(f)))(ffa => Free.liftF(ffa).flatMap(a => a))\n        case Xor.Right(a) => ap.map(f(a))(Free.pure(_))\n      }\n\n    def foldLeft[A, B](fa: Free[F, A], b: B)(f: (B, A) => B): B = ???\n\n    def foldRight[A, B](fa: Free[F, A], lb: Eval[B])(f: (A, Eval[B]) => Eval[B]): Eval[B] = ???\n  }\n}\n"
  },
  {
    "path": "cats/src/test/scala/emm/WrapperSpecs.scala",
    "content": "package emm\n\nimport emm.compat.cats._\n\nimport org.specs2.mutable._\n\nimport cats._\nimport cats.data._\nimport cats.free.Free\nimport cats.std.option._\nimport cats.std.list._\n\nobject WrapperSpecs extends Specification with TestHelpers {\n\n  \"simple effect composition with wrapper\" should {\n\n    \"allow wrapping of two paired constructors\" in {\n      Option(List(42)).wrapM must haveType[Emm[Option |: List |: Base, Int]].attempt\n      Option(List(42)).wrapM[Option |: List |: Base] must haveType[Emm[Option |: List |: Base, Int]].attempt\n    }\n\n    \"allow wrapping of two paired constructors where one has arity-2\" in {\n      \"inner\" >> {\n        type E = Option |: (String Xor ?) |: Base\n\n        Option(Xor.right[String, Int](42)).wrapM must haveType[Emm[Option |: (String Xor ?) |: Base, Int]].attempt\n        Option(Xor.right[String, Int](42)).wrapM[E] must haveType[Emm[Option |: (String Xor ?) |: Base, Int]].attempt\n      }\n\n      \"outer\" >> {\n        type E = (String Xor ?) |: Option |: Base\n\n        Xor.right[String, Option[Int]](Option(42)).wrapM must haveType[Emm[(String Xor ?) |: Option |: Base, Int]].attempt\n        Xor.right[String, Option[Int]](Option(42)).wrapM[E] must haveType[Emm[(String Xor ?) |: Option |: Base, Int]].attempt\n      }\n    }\n\n    \"allow wrapping of two paired constructors where one is higher-order and has arity-2\" in {\n      \"inner\" >> {\n        type E = Option |: Free[List, ?] |: Base\n\n        Option(Free.pure[List, Int](42)).wrapM must haveType[Emm[Option |: Free[List, ?] |: Base, Int]].attempt\n        Option(Free.pure[List, Int](42)).wrapM[E] must haveType[Emm[Option |: Free[List, ?] |: Base, Int]].attempt\n      }\n\n      \"outer\" >> {\n        type E = Free[List, ?] |: Option |: Base\n\n        Free.pure[List, Option[Int]](Option(42)).wrapM must haveType[Emm[Free[List, ?] |: Option |: Base, Int]].attempt\n        Free.pure[List, Option[Int]](Option(42)).wrapM[E] must haveType[Emm[Free[List, ?] |: Option |: Base, Int]].attempt\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "core/build.sbt",
    "content": "name := \"emm-core\"\n\nlibraryDependencies += \"com.codecommit\" %% \"shims-core\" % shimsVersion.value"
  },
  {
    "path": "core/src/main/scala/emm/Emm.scala",
    "content": "package emm\n\nfinal case class Emm[C <: Effects, A](run: C#Point[A]) {\n  import effects._\n\n  def map[B](f: A => B)(implicit C: Mapper[C]): Emm[C, B] = Emm(C.map(run)(f))\n\n  def flatMap[B](f: A => Emm[C, B])(implicit B: Binder[C]): Emm[C, B] =\n    Emm(B.bind(run) { a => f(a).run })\n\n  def flatMapM[E](f: A => E)(implicit E: Lifter[E, C], B: Binder[C]): Emm[C, E.Out] =\n    flatMap { a => Emm(E(f(a))) }\n\n  def expand(implicit C: Expander[C]): Emm[C.Out, C.CC[A]] = Emm(C(run))\n\n  def collapse(implicit C: Collapser[A, C]): Emm[C.Out, C.A] = Emm(C(run))\n}\n\nobject Emm {\n  import effects._\n\n  def point[C <: Effects, A](a: A)(implicit M: Mapper[C]): Emm[C, A] = Emm[C, A](M.point(a))\n\n  def lift[C <: Effects, A](a: A)(implicit L: Lifter[A, C]): Emm[C, L.Out] = Emm(L(a))\n\n  def wrap[C <: Effects, A](a: A)(implicit W: Wrapper[A, C]): Emm[C, W.A] = Emm[C, W.A](W(a))\n}\n\n/*trait EmmLowPriorityImplicits1 {\n  import effects._\n\n  implicit def functorInstance[C <: Effects](implicit C: Mapper[C]): Functor[Emm[C, ?]] = new Functor[Emm[C, ?]] {\n\n    def map[A, B](fa: Emm[C, A])(f: A => B): Emm[C, B] = new Emm(C.map(fa.run)(f))\n  }\n}\n\ntrait EmmLowPriorityImplicits2 extends EmmLowPriorityImplicits1 {\n  import effects._\n\n  implicit def monadInstance[C <: Effects : Mapper : Binder]: Monad[Emm[C, ?]] = new Monad[Emm[C, ?]] {\n\n    def pure[A](a: A): Emm[C, A] = new Emm(implicitly[Mapper[C]].point(a))\n\n    def flatMap[A, B](fa: Emm[C, A])(f: A => Emm[C, B]): Emm[C, B] = fa flatMap f\n  }\n}\n\nobject Emm extends EmmLowPriorityImplicits2 {\n  import effects._\n\n  implicit def traverseInstance[C <: Effects](implicit C: Traverser[C]): Traverse[Emm[C, ?]] = new Traverse[Emm[C, ?]] {\n    def traverse[G[_]: Applicative, A, B](fa: Emm[C, A])(f: A => G[B]): G[Emm[C, B]] =\n      Applicative[G].map(C.traverse(fa.run)(f)) { new Emm(_) }\n\n    def foldLeft[A, B](fa: Emm[C, A], b: B)(f: (B, A) => B): B = C.foldLeft(fa.run, b)(f)\n\n    def foldRight[A, B](fa: Emm[C, A], lb: Eval[B])(f: (A, Eval[B]) => Eval[B]): Eval[B] = C.foldRight(fa.run, lb)(f)\n\n  }\n}*/\n"
  },
  {
    "path": "core/src/main/scala/emm/effects/Binder.scala",
    "content": "package emm\npackage effects\n\nimport shims.{Applicative, FlatMap, Functor, Monad, Traverse}\nimport scala.annotation.implicitNotFound\n\nimport properties._\n\n@implicitNotFound(\"could not prove ${C} is a valid monadic stack; perhaps an effect is lacking a FlatMap, or a non-outer effect is lacking a Traverse\")\ntrait Binder[C <: Effects] {\n  type CC[A] = C#Point[A]\n\n  def bind[A, B](cca: CC[A])(f: A => CC[B]): CC[B]\n}\n\nobject Binder {\n\n  implicit def base: Binder[Base] = new Binder[Base] {\n    def bind[A, B](fa: A)(f: A => B): B = f(fa)\n  }\n\n  implicit def corecurse1[F[_], C <: Effects](implicit C: Binder[C], T: Traverser[C], NN: NonNested[C], F: Applicative[F], B: FlatMap[F]): Binder[F |: C] = new Binder[F |: C] {\n\n    def bind[A, B](fca: CC[A])(f: A => CC[B]): CC[B] = {\n      val back = B.flatMap(NN.unpack(fca)) { ca =>\n        val fcaca = T.traverse(ca) { a => NN.unpack(f(a)) }\n\n        F.map(fcaca) { caca => C.bind(caca) { a => a } }\n      }\n\n      NN.pack(back)\n    }\n  }\n\n  implicit def corecurse2[F[_, _], F2[_, _], Z, C <: Effects](implicit ev: Permute2[F, F2], C: Binder[C], NN: NonNested[C], T: Traverser[C], F: Applicative[F2[Z, ?]], B: FlatMap[F2[Z, ?]]): Binder[F2[Z, ?] |: C] = corecurse1[F2[Z, ?], C]\n  implicit def corecurse3[F[_, _, _], F2[_, _, _], Y, Z, C <: Effects](implicit ev: Permute3[F, F2], C: Binder[C], NN: NonNested[C], T: Traverser[C], F: Applicative[F2[Y, Z, ?]], B: FlatMap[F2[Y, Z, ?]]): Binder[F2[Y, Z, ?] |: C] = corecurse1[F2[Y, Z, ?], C]\n\n  implicit def corecurseH1[F[_[_], _], G[_], C <: Effects](implicit C: Binder[C], T: Traverser[C], NN: NonNested[C], F: Applicative[F[G, ?]], B: FlatMap[F[G, ?]]): Binder[F[G, ?] |: C] = corecurse1[F[G, ?], C]\n  implicit def corecurseH2[F[_[_], _, _], F2[_[_], _, _], G[_], Z, C <: Effects](implicit ev: PermuteH2[F, F2], C: Binder[C], T: Traverser[C], NN: NonNested[C], F: Applicative[F2[G, Z, ?]], B: FlatMap[F2[G, Z, ?]]): Binder[F2[G, Z, ?] |: C] = corecurse1[F2[G, Z, ?], C]\n  implicit def corecurseH3[F[_[_], _, _, _], F2[_[_], _, _, _], G[_], Y, Z, C <: Effects](implicit ev: PermuteH3[F, F2], C: Binder[C], T: Traverser[C], NN: NonNested[C], F: Applicative[F2[G, Y, Z, ?]], B: FlatMap[F2[G, Y, Z, ?]]): Binder[F2[G, Y, Z, ?] |: C] = corecurse1[F2[G, Y, Z, ?], C]\n\n  implicit def pivot1[Pivot[_[_], _], C <: Effects, F <: Effects, T <: Effects](implicit NAP: NestedAtPoint[C, Pivot, F, T], Pivot: Monad[Pivot[F#Point, ?]], TB: Binder[T], TT: Traverser[T]): Binder[C] = new Binder[C] {\n\n    def bind[A, B](fca: CC[A])(f: A => CC[B]): CC[B] = {\n      val back: Pivot[F#Point, T#Point[B]] = Pivot.flatMap(NAP.unpack(fca)) { ca =>\n        val ptta: Pivot[F#Point, T#Point[T#Point[B]]] = TT.traverse[Pivot[F#Point, ?], A, T#Point[B]](ca)(a => NAP.unpack(f(a)))\n\n        Pivot.map(ptta)(tta => TB.bind(tta)(a => a))\n      }\n\n      NAP.pack(back)\n    }\n  }\n\n  implicit def pivot2[Pivot[_[_], _, _], Pivot2[_[_], _, _], Z, C <: Effects, F <: Effects, T <: Effects](implicit NAP: NestedAtPoint[C, Pivot2[?[_], Z, ?], F, T], ev: PermuteH2[Pivot, Pivot2],  Pivot: Monad[Pivot2[F#Point, Z, ?]], TB: Binder[T], TT: Traverser[T]): Binder[C] = pivot1[Pivot2[?[_], Z, ?], C, F, T]\n  implicit def pivot3[Pivot[_[_], _, _, _], Pivot2[_[_], _, _, _], Y, Z, C <: Effects, F <: Effects, T <: Effects](implicit NAP: NestedAtPoint[C, Pivot2[?[_], Y, Z, ?], F, T], ev: PermuteH3[Pivot, Pivot2],  Pivot: Monad[Pivot2[F#Point, Y, Z, ?]], TB: Binder[T], TT: Traverser[T]): Binder[C] = pivot1[Pivot2[?[_], Y, Z, ?], C, F, T]\n}\n"
  },
  {
    "path": "core/src/main/scala/emm/effects/Collapser.scala",
    "content": "package emm\npackage effects\n\nimport shims.{Applicative, FlatMap, Functor, Monad, Traverse}\nimport scala.annotation.implicitNotFound\n\nimport properties._\n\ntrait Collapser[E, C <: Effects] {\n  type A\n  type Out <: Effects\n\n  type Point[A] = C#Point[A]\n\n  def apply(fa: Point[E]): Out#Point[A]\n}\n\ntrait CollapserLowPriorityImplicits2 {\n\n  def head1[F[_], A0]: Collapser.Aux[F[A0], Base, A0, F |: Base]\n\n  implicit def headH2[F[_[_], _, _], F2[_[_], _, _], G[_], Z, A0](implicit ev: PermuteH2[F, F2]): Collapser.Aux[F2[G, Z, A0], Base, A0, F2[G, Z, ?] |: Base] =  head1[F2[G, Z, ?], A0]\n  implicit def headH3[F[_[_], _, _, _], F2[_[_], _, _, _], G[_], Y, Z, A0](implicit ev: PermuteH3[F, F2]): Collapser.Aux[F2[G, Y, Z, A0], Base, A0, F2[G, Y, Z, ?] |: Base] =  head1[F2[G, Y, Z, ?], A0]\n\n  def corecurse1[E, F[_], C <: Effects](implicit C: Collapser[E, C]): Collapser.Aux[E, F |: C, C.A, F |: C.Out]\n\n  implicit def corecurseH2[E, F[_[_], _, _], F2[_[_], _, _], G[_], Z, C <: Effects](implicit ev: PermuteH2[F, F2], C: Collapser[E, C]): Collapser.Aux[E, F2[G, Z, ?] |: C, C.A, F2[G, Z, ?] |: C.Out] = corecurse1[E, F2[G, Z, ?], C]\n  implicit def corecurseH3[E, F[_[_], _, _, _], F2[_[_], _, _, _], G[_], Y, Z, C <: Effects](implicit ev: PermuteH3[F, F2], C: Collapser[E, C]): Collapser.Aux[E, F2[G, Y, Z, ?] |: C, C.A, F2[G, Y, Z, ?] |: C.Out] = corecurse1[E, F2[G, Y, Z, ?], C]\n}\n\nobject Collapser extends CollapserLowPriorityImplicits2 {\n  type Aux[E, C <: Effects, A0, Out0 <: Effects] = Collapser[E, C] { type A = A0; type Out = Out0 }\n\n  implicit def head1[F[_], A0]: Collapser.Aux[F[A0], Base, A0, F |: Base] = new Collapser[F[A0], Base] {\n    type A = A0\n    type Out = F |: Base\n\n    def apply(fa: F[A]): F[A] = fa\n  }\n\n  implicit def head2[F[_, _], F2[_, _], Z, A0](implicit ev: Permute2[F, F2]): Collapser.Aux[F2[Z, A0], Base, A0, F2[Z, ?] |: Base] = head1[F2[Z, ?], A0]\n  implicit def head3[F[_, _, _], F2[_, _, _], Y, Z, A0](implicit ev: Permute3[F, F2]): Collapser.Aux[F2[Y, Z, A0], Base, A0, F2[Y, Z, ?] |: Base] =  head1[F2[Y, Z, ?], A0]\n\n  implicit def headH1[F[_[_], _], G[_], A0]: Collapser.Aux[F[G, A0], Base, A0, F[G, ?] |: Base] =  head1[F[G, ?], A0]\n\n  implicit def corecurse1[E, F[_], C <: Effects](implicit C: Collapser[E, C]): Collapser.Aux[E, F |: C, C.A, F |: C.Out] = new Collapser[E, F |: C] {\n    type A = C.A\n    type Out = F |: C.Out\n\n    def apply(gca: Point[E]): Out#Point[A] =\n      gca.asInstanceOf[Out#Point[A]]      // already proven equivalent; evaluation requires a Functor\n  }\n\n  implicit def corecurse2[E, F[_, _], F2[_, _], Z, C <: Effects](implicit ev: Permute2[F, F2], C: Collapser[E, C]): Collapser.Aux[E, F2[Z, ?] |: C, C.A, F2[Z, ?] |: C.Out] = corecurse1[E, F2[Z, ?], C]\n  implicit def corecurse3[E, F[_, _, _], F2[_, _, _], Y, Z, C <: Effects](implicit ev: Permute3[F, F2], C: Collapser[E, C]): Collapser.Aux[E, F2[Y, Z, ?] |: C, C.A, F2[Y, Z, ?] |: C.Out] = corecurse1[E, F2[Y, Z, ?], C]\n\n  implicit def corecurseH1[E, F[_[_], _], G[_], C <: Effects](implicit C: Collapser[E, C]): Collapser.Aux[E, F[G, ?] |: C, C.A, F[G, ?] |: C.Out] = corecurse1[E, F[G, ?], C]\n\n  // C == F ++ (Pivot -|: T)\n  implicit def pivot1[E, Pivot[_[_], _], C <: Effects, F <: Effects, T <: Effects](implicit NAP: NestedAtPoint[C, Pivot, F, T], T: Collapser[E, T]): Collapser.Aux[E, C, T.A, F#Append[Pivot -|: T.Out]] = new Collapser[E, C] {\n    type A = T.A\n    type Out = F#Append[Pivot -|: T.Out]\n\n    def apply(gca: Point[E]): Out#Point[A] =\n      gca.asInstanceOf[Out#Point[A]]      // already proven equivalent; evaluation requires a Functor\n  }\n\n  implicit def pivot2[E, Pivot[_[_], _, _], Z, C <: Effects, F <: Effects, T <: Effects](implicit NAP: NestedAtPoint[C, Pivot[?[_], Z, ?], F, T], T: Collapser[E, T]): Collapser.Aux[E, C, T.A, F#Append[Pivot[?[_], Z, ?] -|: T.Out]] = pivot1[E, Pivot[?[_], Z, ?], C, F, T]\n  implicit def pivot3[E, Pivot[_[_], _, _, _], Y, Z, C <: Effects, F <: Effects, T <: Effects](implicit NAP: NestedAtPoint[C, Pivot[?[_], Y, Z, ?], F, T], T: Collapser[E, T]): Collapser.Aux[E, C, T.A, F#Append[Pivot[?[_], Y, Z, ?] -|: T.Out]] = pivot1[E, Pivot[?[_], Y, Z, ?], C, F, T]\n}\n"
  },
  {
    "path": "core/src/main/scala/emm/effects/Expander.scala",
    "content": "package emm\npackage effects\n\nimport shims.{Applicative, FlatMap, Functor, Monad, Traverse}\nimport scala.annotation.implicitNotFound\n\nimport properties._\n\ntrait Expander[C <: Effects] {\n  type CC[_]\n  type Out <: Effects\n\n  type Point[A] = C#Point[A]\n\n  def apply[A](fa: Point[A]): Out#Point[CC[A]]\n}\n\nobject Expander {\n  type Aux[C <: Effects, CC0[_], Out0 <: Effects] = Expander[C] { type CC[A] = CC0[A]; type Out = Out0 }\n\n  implicit def head1[F[_]]: Expander.Aux[F |: Base, F, Base] = new Expander[F |: Base] {\n    type CC[A] = F[A]\n    type Out = Base\n\n    def apply[A](fa: F[A]): F[A] = fa\n  }\n\n  implicit def head2[F[_, _], F2[_, _], Z](implicit ev: Permute2[F, F2]): Expander.Aux[F2[Z, ?] |: Base, F2[Z, ?], Base] = head1[F2[Z, ?]]\n  implicit def head3[F[_, _, _], F2[_, _, _], Y, Z](implicit ev: Permute3[F, F2]): Expander.Aux[F2[Y, Z, ?] |: Base, F2[Y, Z, ?], Base] = head1[F2[Y, Z, ?]]\n\n  implicit def headH1[F[_[_], _], G[_]]: Expander.Aux[F[G, ?] |: Base, F[G, ?], Base] = head1[F[G, ?]]\n  implicit def headH2[F[_[_], _, _], F2[_[_], _, _], G[_], Z](implicit ev: PermuteH2[F, F2]): Expander.Aux[F2[G, Z, ?] |: Base, F2[G, Z, ?], Base] = head1[F2[G, Z, ?]]\n  implicit def headH3[F[_[_], _, _, _], F2[_[_], _, _, _], G[_], Y, Z](implicit ev: PermuteH3[F, F2]): Expander.Aux[F2[G, Y, Z, ?] |: Base, F2[G, Y, Z, ?], Base] = head1[F2[G, Y, Z, ?]]\n\n  implicit def corecurse1[F[_], C <: Effects](implicit C: Expander[C]): Expander.Aux[F |: C, C.CC, F |: C.Out] = new Expander[F |: C] {\n    type CC[A] = C.CC[A]\n    type Out = F |: C.Out\n\n    def apply[A](gca: Point[A]): Out#Point[CC[A]] =\n      gca.asInstanceOf[Out#Point[CC[A]]]     // already proven equivalent; evaluation requires a Functor\n  }\n\n  implicit def corecurse2[F[_, _], F2[_, _], Z, C <: Effects](implicit ev: Permute2[F, F2], C: Expander[C]): Expander.Aux[F2[Z, ?] |: C, C.CC, F2[Z, ?] |: C.Out] = corecurse1[F2[Z, ?], C]\n  implicit def corecurse3[F[_, _, _], F2[_, _, _], Y, Z, C <: Effects](implicit ev: Permute3[F, F2], C: Expander[C]): Expander.Aux[F2[Y, Z, ?] |: C, C.CC, F2[Y, Z, ?] |: C.Out] = corecurse1[F2[Y, Z, ?], C]\n\n  implicit def corecurseH1[F[_[_], _], G[_], C <: Effects](implicit C: Expander[C]): Expander.Aux[F[G, ?] |: C, C.CC, F[G, ?] |: C.Out] = corecurse1[F[G, ?], C]\n  implicit def corecurseH2[F[_[_], _, _], F2[_[_], _, _], G[_], Z, C <: Effects](implicit ev: PermuteH2[F, F2], C: Expander[C]): Expander.Aux[F2[G, Z, ?] |: C, C.CC, F2[G, Z, ?] |: C.Out] = corecurse1[F2[G, Z, ?], C]\n  implicit def corecurseH3[F[_[_], _, _, _], F2[_[_], _, _, _], G[_], Y, Z, C <: Effects](implicit ev: PermuteH3[F, F2], C: Expander[C]): Expander.Aux[F2[G, Y, Z, ?] |: C, C.CC, F2[G, Y, Z, ?] |: C.Out] = corecurse1[F2[G, Y, Z, ?], C]\n\n  implicit def pivot1Base[Pivot[_[_], _], C <: Effects, F <: Effects](implicit NAP: NestedAtPoint[C, Pivot, F, Base]): Expander.Aux[C, Pivot[F#Point, ?], Base] = new Expander[C] {\n    type CC[A] = Pivot[F#Point, A]\n    type Out = Base\n\n    def apply[A](gca: C#Point[A]): Out#Point[CC[A]] =\n      gca.asInstanceOf[Out#Point[CC[A]]]     // already proven equivalent; evaluation requires a Functor\n  }\n\n  implicit def pivot2Base[Pivot[_[_], _, _], Z, C <: Effects, F <: Effects](implicit NAP: NestedAtPoint[C, Pivot[?[_], Z, ?], F, Base]): Expander.Aux[C, Pivot[F#Point, Z, ?], Base] = pivot1Base[Pivot[?[_], Z, ?], C, F](NAP)\n  implicit def pivot3Base[Pivot[_[_], _, _, _], Y, Z, C <: Effects, F <: Effects](implicit NAP: NestedAtPoint[C, Pivot[?[_], Y, Z, ?], F, Base]): Expander.Aux[C, Pivot[F#Point, Y, Z, ?], Base] = pivot1Base[Pivot[?[_], Y, Z, ?], C, F](NAP)\n\n  // C == F ++ (Pivot -|: T)\n  implicit def pivot1[Pivot[_[_], _], C <: Effects, F <: Effects, T <: Effects](implicit NAP: NestedAtPoint[C, Pivot, F, T], T: Expander[T]): Expander.Aux[C, T.CC, F#Append[Pivot -|: T.Out]] = new Expander[C] {\n    type CC[A] = T.CC[A]\n    type Out = F#Append[Pivot -|: T.Out]\n\n    def apply[A](gca: C#Point[A]): Out#Point[CC[A]] =\n      gca.asInstanceOf[Out#Point[CC[A]]]     // already proven equivalent; evaluation requires a Functor\n  }\n\n  implicit def pivot2[Pivot[_[_], _, _], Z, C <: Effects, F <: Effects, T <: Effects](implicit NAP: NestedAtPoint[C, Pivot[?[_], Z, ?], F, T], T: Expander[T]): Expander.Aux[C, T.CC, F#Append[Pivot[?[_], Z, ?] -|: T.Out]] = pivot1[Pivot[?[_], Z, ?], C, F, T]\n  implicit def pivot3[Pivot[_[_], _, _, _], Y, Z, C <: Effects, F <: Effects, T <: Effects](implicit NAP: NestedAtPoint[C, Pivot[?[_], Y, Z, ?], F, T], T: Expander[T]): Expander.Aux[C, T.CC, F#Append[Pivot[?[_], Y, Z, ?] -|: T.Out]] = pivot1[Pivot[?[_], Y, Z, ?], C, F, T]\n}\n"
  },
  {
    "path": "core/src/main/scala/emm/effects/Lifter.scala",
    "content": "package emm\npackage effects\n\nimport shims.{Applicative, FlatMap, Functor, Monad, Traverse}\nimport scala.annotation.implicitNotFound\n\nimport properties._\n\n@implicitNotFound(\"could not lift ${E} into stack ${C}; either ${C} does not contain a constructor of ${E}, or there is no Functor for a constructor of ${E}\")\ntrait Lifter[E, C <: Effects] {\n  type Out\n  type CC[A] = C#Point[A]\n\n  def apply(e: E): CC[Out]\n}\n\nobject Lifter {\n  type Aux[E, C <: Effects, Out0] = Lifter[E, C] { type Out = Out0 }\n\n  implicit def mid1[F[_], A, C <: Effects](implicit C: Mapper[C], F: Functor[F], NN: NonNested[C]): Lifter.Aux[F[A], F |: C, A] = new Lifter[F[A], F |: C] {\n    type Out = A\n\n    def apply(fa: F[A]) = NN.pack(F.map(fa) { a => C.point(a) })\n  }\n\n  implicit def mid2[F[_, _], F2[_, _], Z, A, C <: Effects](implicit ev: Permute2[F, F2], C: Mapper[C], F: Functor[F2[Z, ?]], NN: NonNested[C]): Lifter.Aux[F2[Z, A], F2[Z, ?] |: C, A] = mid1[F2[Z, ?], A, C]\n  implicit def mid3[F[_, _, _], F2[_, _, _], Y, Z, A, C <: Effects](implicit ev: Permute3[F, F2], C: Mapper[C], F: Functor[F2[Y, Z, ?]], NN: NonNested[C]): Lifter.Aux[F2[Y, Z, A], F2[Y, Z, ?] |: C, A] = mid1[F2[Y, Z, ?], A, C]\n\n  implicit def midH1[F[_[_], _], G[_], A, C <: Effects](implicit C: Mapper[C], F: Functor[F[G, ?]], NN: NonNested[C]): Lifter.Aux[F[G, A], F[G, ?] |: C, A] = mid1[F[G, ?], A, C]\n  implicit def midH2[F[_[_], _, _], F2[_[_], _, _], G[_], Z, A, C <: Effects](implicit ev: PermuteH2[F, F2], C: Mapper[C], F: Functor[F2[G, Z, ?]], NN: NonNested[C]): Lifter.Aux[F2[G, Z, A], F2[G, Z, ?] |: C, A] = mid1[F2[G, Z, ?], A, C]\n  implicit def midH3[F[_[_], _, _, _], F2[_[_], _, _, _], G[_], Y, Z, A, C <: Effects](implicit ev: PermuteH3[F, F2], C: Mapper[C], F: Functor[F2[G, Y, Z, ?]], NN: NonNested[C]): Lifter.Aux[F2[G, Y, Z, A], F2[G, Y, Z, ?] |: C, A] = mid1[F2[G, Y, Z, ?], A, C]\n\n  implicit def corecurse1[F[_], E, C <: Effects](implicit L: Lifter[E, C], F: Applicative[F], NN: NonNested[C]): Lifter.Aux[E, F |: C, L.Out] = new Lifter[E, F |: C] {\n    type Out = L.Out\n\n    def apply(e: E) = NN.pack(F.point(L(e)))\n  }\n\n  implicit def corecurse2[F[_, _], F2[_, _], Z, E, C <: Effects](implicit ev: Permute2[F, F2], L: Lifter[E, C], F: Applicative[F2[Z, ?]], NN: NonNested[C]): Lifter.Aux[E, F2[Z, ?] |: C, L.Out] = corecurse1[F2[Z, ?], E, C]\n  implicit def corecurse3[F[_, _, _], F2[_, _, _], Y, Z, E, C <: Effects](implicit ev: Permute3[F, F2], L: Lifter[E, C], F: Applicative[F2[Y, Z, ?]], NN: NonNested[C]): Lifter.Aux[E, F2[Y, Z, ?] |: C, L.Out] = corecurse1[F2[Y, Z, ?], E, C]\n\n  implicit def corecurseH1[F[_[_], _], G[_], E, C <: Effects](implicit L: Lifter[E, C], F: Applicative[F[G, ?]], NN: NonNested[C]): Lifter.Aux[E, F[G, ?] |: C, L.Out] = corecurse1[F[G, ?], E, C]\n  implicit def corecurseH2[F[_[_], _, _], F2[_[_], _, _], G[_], Z, E, C <: Effects](implicit ev: PermuteH2[F, F2], L: Lifter[E, C], F: Applicative[F2[G, Z, ?]], NN: NonNested[C]): Lifter.Aux[E, F2[G, Z, ?] |: C, L.Out] = corecurse1[F2[G, Z, ?], E, C]\n  implicit def corecurseH3[F[_[_], _, _, _], F2[_[_], _, _, _], G[_], Y, Z, E, C <: Effects](implicit ev: PermuteH3[F, F2], L: Lifter[E, C], F: Applicative[F2[G, Y, Z, ?]], NN: NonNested[C]): Lifter.Aux[E, F2[G, Y, Z, ?] |: C, L.Out] = corecurse1[F2[G, Y, Z, ?], E, C]\n}"
  },
  {
    "path": "core/src/main/scala/emm/effects/Mapper.scala",
    "content": "package emm\npackage effects\n\nimport shims.{Applicative, FlatMap, Functor, Monad, Traverse}\nimport scala.annotation.implicitNotFound\n\nimport properties._\n\n@implicitNotFound(\"could not compute a method for mapping over effect stack ${C}; either a member of the stack lacks an Applicative, or its Applicative instance is ambiguous\")\ntrait Mapper[C <: Effects] { outer =>\n  type CC[A] = C#Point[A]\n\n  def point[A](a: A): CC[A]\n\n  def map[A, B](fa: CC[A])(f: A => B): CC[B]\n\n  def functor: Functor[CC] = new Functor[CC] {\n    def map[A, B](fa: CC[A])(f: A => B): CC[B] = outer.map(fa)(f)\n  }\n}\n\nobject Mapper {\n\n  implicit def base: Mapper[Base] = new Mapper[Base] {\n    def point[A](a: A) = a\n    def map[A, B](fa: A)(f: A => B) = f(fa)\n  }\n\n  implicit def corecurse1[F[_], C <: Effects](implicit P: Mapper[C], NN: NonNested[C], F: Applicative[F]): Mapper[F |: C] = new Mapper[F |: C] {\n\n    def point[A](a: A) = NN.pack(F.point(P.point(a)))\n\n    def map[A, B](fa: CC[A])(f: A => B): CC[B] =\n      NN.pack(F.map(NN.unpack(fa)) { ca => P.map(ca)(f) })\n  }\n\n  implicit def corecurse2[F[_, _], F2[_, _], Z, C <: Effects](implicit ev: Permute2[F, F2], P: Mapper[C], NN: NonNested[C], F: Applicative[F2[Z, ?]]): Mapper[F2[Z, ?] |: C] = corecurse1[F2[Z, ?], C]\n  implicit def corecurse3[F[_, _, _], F2[_, _, _], Y, Z, C <: Effects](implicit ev: Permute3[F, F2], P: Mapper[C], NN: NonNested[C], F: Applicative[F2[Y, Z, ?]]): Mapper[F2[Y, Z, ?] |: C] = corecurse1[F2[Y, Z, ?], C]\n\n  implicit def corecurseH1[F[_[_], _], G[_], C <: Effects](implicit P: Mapper[C], NN: NonNested[C], F: Applicative[F[G, ?]]): Mapper[F[G, ?] |: C] = corecurse1[F[G, ?], C]\n  implicit def corecurseH2[F[_[_], _, _], F2[_[_], _, _], G[_], Z, C <: Effects](implicit ev: PermuteH2[F, F2], P: Mapper[C], NN: NonNested[C], F: Applicative[F2[G, Z, ?]]): Mapper[F2[G, Z, ?] |: C] = corecurse1[F2[G, Z, ?], C]\n  implicit def corecurseH3[F[_[_], _, _, _], F2[_[_], _, _, _], G[_], Y, Z, C <: Effects](implicit ev: PermuteH3[F, F2], P: Mapper[C], NN: NonNested[C], F: Applicative[F2[G, Y, Z, ?]]): Mapper[F2[G, Y, Z, ?] |: C] = corecurse1[F2[G, Y, Z, ?], C]\n\n  implicit def pivot1[Pivot[_[_], _], C <: Effects, F <: Effects, T <: Effects](implicit NAP: NestedAtPoint[C, Pivot, F, T], Pivot: Applicative[Pivot[F#Point, ?]], T: Mapper[T]): Mapper[C] = new Mapper[C] {\n\n    def point[A](a: A): CC[A] = NAP.pack(Pivot.point(T.point(a)))\n\n    def map[A, B](fa: CC[A])(f: A => B): CC[B] =\n      NAP.pack(Pivot.map(NAP.unpack(fa)) { ta => T.map(ta)(f) })\n  }\n\n  implicit def pivot2[Pivot[_[_], _, _], Pivot2[_[_], _, _], Z, C <: Effects, F <: Effects, T <: Effects](implicit NAP: NestedAtPoint[C, Pivot2[?[_], Z, ?], F, T], ev: PermuteH2[Pivot, Pivot2], Pivot: Applicative[Pivot2[F#Point, Z, ?]], T: Mapper[T]): Mapper[C] = pivot1[Pivot2[?[_], Z, ?], C, F, T]\n  implicit def pivot3[Pivot[_[_], _, _, _], Pivot2[_[_], _, _, _], Y, Z, C <: Effects, F <: Effects, T <: Effects](implicit NAP: NestedAtPoint[C, Pivot2[?[_], Y, Z, ?], F, T], ev: PermuteH3[Pivot, Pivot2], Pivot: Applicative[Pivot2[F#Point, Y, Z, ?]], T: Mapper[T]): Mapper[C] = pivot1[Pivot2[?[_], Y, Z, ?], C, F, T]\n}\n"
  },
  {
    "path": "core/src/main/scala/emm/effects/MapperBinder.scala",
    "content": "package emm\npackage effects\n\nimport shims.Monad\n\nprivate[emm] object MapperBinder {\n\n  implicit def monad[F <: Effects](implicit FB: Binder[F], FM: Mapper[F]): Monad[F#Point] = new Monad[F#Point] {\n    def point[A](a: A): F#Point[A] = FM.point(a)\n    override def map[A, B](fa: F#Point[A])(f: A => B): F#Point[B] = FM.map(fa)(f)\n    def flatMap[A, B](fa: F#Point[A])(f: A => F#Point[B]): F#Point[B] = FB.bind(fa)(f)\n  }\n}"
  },
  {
    "path": "core/src/main/scala/emm/effects/Traverser.scala",
    "content": "package emm\npackage effects\n\nimport shims.{Applicative, FlatMap, Functor, Monad, Traverse}\nimport scala.annotation.implicitNotFound\n\nimport properties._\n\ntrait Traverser[C <: Effects] {\n  type CC[A] = C#Point[A]\n\n  def traverse[G[_]: Applicative, A, B](ca: CC[A])(f: A => G[B]): G[CC[B]]\n}\n\nobject Traverser {\n\n  implicit def base: Traverser[Base] = new Traverser[Base] {\n    def traverse[G[_]: Applicative, A, B](fa: A)(f: A => G[B]): G[B] = f(fa)\n  }\n\n  implicit def corecurse1[F[_], C <: Effects](implicit C: Traverser[C], NN: NonNested[C], F: Traverse[F]): Traverser[F |: C] = new Traverser[F |: C] {\n\n    def traverse[G[_]: Applicative, A, B](fca: CC[A])(f: A => G[B]): G[CC[B]] = {\n      val back = F.traverse(NN.unpack(fca)) { ca =>\n        C.traverse(ca)(f)\n      }\n\n      implicitly[Applicative[G]].map(back) { fca2 => NN.pack(fca2) }\n    }\n  }\n\n  implicit def corecurse2[F[_, _], F2[_, _], Z, C <: Effects](implicit ev: Permute2[F, F2], C: Traverser[C], NN: NonNested[C], F: Traverse[F2[Z, ?]]): Traverser[F2[Z, ?] |: C] = corecurse1[F2[Z, ?], C]\n  implicit def corecurse3[F[_, _, _], F2[_, _, _], Y, Z, C <: Effects](implicit ev: Permute3[F, F2], C: Traverser[C], NN: NonNested[C], F: Traverse[F2[Y, Z, ?]]): Traverser[F2[Y, Z, ?] |: C] = corecurse1[F2[Y, Z, ?], C]\n\n  implicit def corecurseH1[F[_[_], _], G0[_], C <: Effects](implicit C: Traverser[C], NN: NonNested[C], F: Traverse[F[G0, ?]]): Traverser[F[G0, ?] |: C] = corecurse1[F[G0, ?], C]\n  implicit def corecurseH2[F[_[_], _, _], F2[_[_], _, _], G0[_], Z, C <: Effects](implicit ev: PermuteH2[F, F2], C: Traverser[C], NN: NonNested[C], F: Traverse[F2[G0, Z, ?]]): Traverser[F2[G0, Z, ?] |: C] = corecurse1[F2[G0, Z, ?], C]\n  implicit def corecurseH3[F[_[_], _, _, _], F2[_[_], _, _, _], G0[_], Y, Z, C <: Effects](implicit ev: PermuteH3[F, F2], C: Traverser[C], NN: NonNested[C], F: Traverse[F2[G0, Y, Z, ?]]): Traverser[F2[G0, Y, Z, ?] |: C] = corecurse1[F2[G0, Y, Z, ?], C]\n\n  implicit def pivot1[Pivot[_[_], _], C <: Effects, F <: Effects, T <: Effects](implicit NAP: NestedAtPoint[C, Pivot, F, T], T: Traverser[T], Pivot: Traverse[Pivot[F#Point, ?]]): Traverser[C] = new Traverser[C] {\n\n    def traverse[G[_]: Applicative, A, B](fca: CC[A])(f: A => G[B]): G[CC[B]] = {\n      val back = Pivot.traverse(NAP.unpack(fca)) { ca =>\n        T.traverse(ca)(f)\n      }\n\n      implicitly[Applicative[G]].map(back) { fca2 => NAP.pack(fca2) }\n    }\n  }\n\n  implicit def pivot2[Pivot[_[_], _, _], Z, C <: Effects, F <: Effects, T <: Effects](implicit NAP: NestedAtPoint[C, Pivot[?[_], Z, ?], F, T], T: Traverser[T], Pivot: Traverse[Pivot[F#Point, Z, ?]]): Traverser[C] = pivot1[Pivot[?[_], Z, ?], C, F, T]\n  implicit def pivot3[Pivot[_[_], _, _, _], Y, Z, C <: Effects, F <: Effects, T <: Effects](implicit NAP: NestedAtPoint[C, Pivot[?[_], Y, Z, ?], F, T], T: Traverser[T], Pivot: Traverse[Pivot[F#Point, Y, Z, ?]]): Traverser[C] = pivot1[Pivot[?[_], Y, Z, ?], C, F, T]\n}"
  },
  {
    "path": "core/src/main/scala/emm/effects/Wrapper.scala",
    "content": "package emm\npackage effects\n\nimport shims.{Applicative, FlatMap, Functor, Monad, Traverse}\nimport scala.annotation.implicitNotFound\n\nimport properties._\n\n@implicitNotFound(\"could not infer effect stack ${C} from type ${E}\")\ntrait Wrapper[E, C <: Effects] {\n  type A\n  type CC[A] = C#Point[A]\n\n  def apply(e: E): CC[A]\n}\n\ntrait WrapperLowPriorityImplicits1 {\n\n  implicit def head[A0]: Wrapper.Aux[A0, Base, A0] = new Wrapper[A0, Base] {\n    type A = A0\n\n    def apply(a: A) = a\n  }\n}\n\n// not really sure why these functions in particular need to be moved down\ntrait WrapperLowPriorityImplicits2 extends WrapperLowPriorityImplicits1 {\n\n  def corecurse1[F[_], E, C <: Effects, A0](implicit W: Wrapper.Aux[E, C, A0]): Wrapper.Aux[F[E], F |: C, A0]\n\n  implicit def corecurseH2[F[_[_], _, _], F2[_[_], _, _], G[_], Z, E, C <: Effects, A0](implicit ev: PermuteH2[F, F2], W: Wrapper.Aux[E, C, A0]): Wrapper.Aux[F2[G, Z, E], F2[G, Z, ?] |: C, A0] = corecurse1[F2[G, Z, ?], E, C, A0]\n  implicit def corecurseH3[F[_[_], _, _, _], F2[_[_], _, _, _], G[_], Y, Z, E, C <: Effects, A0](implicit ev: PermuteH3[F, F2], W: Wrapper.Aux[E, C, A0]): Wrapper.Aux[F2[G, Y, Z, E], F2[G, Y, Z, ?] |: C, A0] = corecurse1[F2[G, Y, Z, ?], E, C, A0]\n}\n\nobject Wrapper extends WrapperLowPriorityImplicits2 {\n  type Aux[E, C <: Effects, A0] = Wrapper[E, C] { type A = A0 }\n\n  implicit def corecurse1[F[_], E, C <: Effects, A0](implicit W: Wrapper.Aux[E, C, A0]): Wrapper.Aux[F[E], F |: C, A0] = new Wrapper[F[E], F |: C] {\n    type A = A0\n\n    def apply(fe: F[E]): CC[A] =\n      fe.asInstanceOf[CC[A]]      // already proven equivalent; actual evaluation requires a Functor\n  }\n\n  implicit def corecurse2[F[_, _], F2[_, _], Z, E, C <: Effects, A0](implicit ev: Permute2[F, F2], W: Wrapper.Aux[E, C, A0]): Wrapper.Aux[F2[Z, E], F2[Z, ?] |: C, A0] = corecurse1[F2[Z, ?], E, C, A0]\n  implicit def corecurse3[F[_, _, _], F2[_, _, _], Y, Z, E, C <: Effects, A0](implicit ev: Permute3[F, F2], W: Wrapper.Aux[E, C, A0]): Wrapper.Aux[F2[Y, Z, E], F2[Y, Z, ?] |: C, A0] = corecurse1[F2[Y, Z, ?], E, C, A0]\n\n  implicit def corecurseH1[F[_[_], _], G[_], E, C <: Effects, A0](implicit W: Wrapper.Aux[E, C, A0]): Wrapper.Aux[F[G, E], F[G, ?] |: C, A0] = corecurse1[F[G, ?], E, C, A0]\n}"
  },
  {
    "path": "core/src/main/scala/emm/effects.scala",
    "content": "package emm\n\n// there's a bug in scalac's cyclic checking with open recursion and type constructors with arity > 1\ntrait Partial {\n  type Apply[F[_]]\n}\n\nsealed trait Effects {\n  type Point[A] = Build[λ[X => X], A]\n\n  type Build[CC[_], A] = Inner[A]#Apply[CC]\n\n  type Inner[A] <: Partial\n\n  type Append[E <: Effects] <: Effects\n}\n\nsealed trait |:[F[_], T <: Effects] extends Effects {\n  type Inner[A] = Partial { type Apply[CC[_]] = T#Inner[A]#Apply[λ[X => CC[F[X]]]] }\n  type Append[E <: Effects] = F |: T#Append[E]\n}\n\nsealed trait -|:[F[_[_], _], T <: Effects] extends Effects {\n  type Inner[A] = Partial { type Apply[CC[_]] = F[CC, T#Inner[A]#Apply[λ[X => X]]] }\n  type Append[E <: Effects] = F -|: T#Append[E]\n}\n\nsealed trait Base extends Effects {\n  type Inner[A] = Partial { type Apply[F[_]] = F[A] }\n  type Append[E <: Effects] = E\n}\n"
  },
  {
    "path": "core/src/main/scala/emm/package.scala",
    "content": "package object emm {\n  import effects._\n\n  implicit class Syntax[A](val a: A) extends AnyVal {\n    def pointM[C <: Effects](implicit M: Mapper[C]): Emm[C, A] = Emm.point[C, A](a)\n    def liftM[C <: Effects](implicit L: Lifter[A, C]): Emm[C, L.Out] = Emm.lift[C, A](a)\n    def wrapM[C <: Effects](implicit W: Wrapper[A, C]): Emm[C, W.A] = Emm.wrap[C, A](a)\n  }\n}\n"
  },
  {
    "path": "core/src/main/scala/emm/permute.scala",
    "content": "package emm\n\nsealed trait Permute2[F[_, _], G[_, _]]\n\nobject Permute2 {\n  implicit def identity[F[_, _]]: Permute2[F, F] = new Permute2[F, F] {}\n  implicit def flip[F[_, _]]: Permute2[F, λ[(A, B) => F[B, A]]] = new Permute2[F, λ[(A, B) => F[B, A]]] {}\n}\n\nsealed trait Permute3[F[_, _, _], G[_, _, _]]\n\nobject Permute3 {\n  implicit def abc[F[_, _, _]]: Permute3[F, F] = new Permute3[F, F] {}\n  implicit def acb[F[_, _, _]]: Permute3[F, λ[(A, B, C) => F[A, C, B]]] = new Permute3[F, λ[(A, B, C) => F[A, C, B]]] {}\n  implicit def bac[F[_, _, _]]: Permute3[F, λ[(A, B, C) => F[B, A, C]]] = new Permute3[F, λ[(A, B, C) => F[B, A, C]]] {}\n  implicit def bca[F[_, _, _]]: Permute3[F, λ[(A, B, C) => F[B, C, A]]] = new Permute3[F, λ[(A, B, C) => F[B, C, A]]] {}\n  implicit def cab[F[_, _, _]]: Permute3[F, λ[(A, B, C) => F[C, A, B]]] = new Permute3[F, λ[(A, B, C) => F[C, A, B]]] {}\n  implicit def cba[F[_, _, _]]: Permute3[F, λ[(A, B, C) => F[C, B, A]]] = new Permute3[F, λ[(A, B, C) => F[C, B, A]]] {}\n}\n\n// for reasons of sanity, we're only going to support left-biased higher-order type constructors (for now)\nsealed trait PermuteH2[F[_[_], _, _], G[_[_], _, _]]\n\nobject PermuteH2 {\n  implicit def identity[F[_[_], _, _]]: PermuteH2[F, F] = new PermuteH2[F, F] {}\n  implicit def flip[F[_[_], _, _]]: PermuteH2[F, λ[(G[_], A, B) => F[G, B, A]]] = new PermuteH2[F, λ[(G[_], A, B) => F[G, B, A]]] {}\n}\n\n// this case gets us scalaz's State, which is all I really care about\nsealed trait PermuteH3[F[_[_], _, _, _], G[_[_], _, _, _]]\n\nobject PermuteH3 {\n  implicit def abc[F[_[_], _, _, _]]: PermuteH3[F, F] = new PermuteH3[F, F] {}\n  implicit def acb[F[_[_], _, _, _]]: PermuteH3[F, λ[(G[_], A, B, C) => F[G, A, C, B]]] = new PermuteH3[F, λ[(G[_], A, B, C) => F[G, A, C, B]]] {}\n  implicit def bac[F[_[_], _, _, _]]: PermuteH3[F, λ[(G[_], A, B, C) => F[G, B, A, C]]] = new PermuteH3[F, λ[(G[_], A, B, C) => F[G, B, A, C]]] {}\n  implicit def bca[F[_[_], _, _, _]]: PermuteH3[F, λ[(G[_], A, B, C) => F[G, B, C, A]]] = new PermuteH3[F, λ[(G[_], A, B, C) => F[G, B, C, A]]] {}\n  implicit def cab[F[_[_], _, _, _]]: PermuteH3[F, λ[(G[_], A, B, C) => F[G, C, A, B]]] = new PermuteH3[F, λ[(G[_], A, B, C) => F[G, C, A, B]]] {}\n  implicit def cba[F[_[_], _, _, _]]: PermuteH3[F, λ[(G[_], A, B, C) => F[G, C, B, A]]] = new PermuteH3[F, λ[(G[_], A, B, C) => F[G, C, B, A]]] {}\n}\n"
  },
  {
    "path": "core/src/main/scala/emm/properties/NestedAtPoint.scala",
    "content": "package emm\npackage properties\n\n/**\n * The property of Effects which contain at least one -|: case, partitioning into a front and tail, where the tail\n * is NonNested and the front is unconstrained.\n */\nsealed trait NestedAtPoint[C <: Effects, Pivot[_[_], _], Front <: Effects, Tail <: Effects] {\n  def NN: NonNested[Tail]\n\n  def pack[A](cc: Pivot[Front#Point, Tail#Point[A]]): C#Point[A]\n  def unpack[A](cc: C#Point[A]): Pivot[Front#Point, Tail#Point[A]]\n}\n\nobject NestedAtPoint {\n\n  implicit def split1[Pivot[_[_], _], C <: Effects](implicit C: NonNested[C]): NestedAtPoint[Pivot -|: C, Pivot, Base, C] = new NestedAtPoint[Pivot -|: C, Pivot, Base, C] {\n    def NN = C\n\n    def pack[A](cc: Pivot[λ[X => X], C#Point[A]]): (Pivot -|: C)#Point[A] = cc.asInstanceOf[(Pivot -|: C)#Point[A]]\n    def unpack[A](cc: (Pivot -|: C)#Point[A]): Pivot[λ[X => X], C#Point[A]] = cc.asInstanceOf[Pivot[λ[X => X], C#Point[A]]]\n  }\n\n  implicit def split2[Pivot[_[_], _, _], Pivot2[_[_], _, _], Z, C <: Effects](implicit ev: PermuteH2[Pivot, Pivot2], C: NonNested[C]): NestedAtPoint[Pivot2[?[_], Z, ?] -|: C, Pivot2[?[_], Z, ?], Base, C] = split1[Pivot2[?[_], Z, ?], C]\n  implicit def split3[Pivot[_[_], _, _, _], Pivot2[_[_], _, _, _], Y, Z, C <: Effects](implicit ev: PermuteH3[Pivot, Pivot2], C: NonNested[C]): NestedAtPoint[Pivot2[?[_], Y, Z, ?] -|: C, Pivot2[?[_], Y, Z, ?], Base, C] = split1[Pivot2[?[_], Y, Z, ?], C]\n\n  implicit def corecurseBar1[Pivot[_[_], _], C <: Effects, C2 <: Effects, F <: Effects, T <: Effects](implicit C2: BarExtract[C, C2], C: NestedAtPoint[C, Pivot, F, T]): NestedAtPoint[C2, Pivot, C2.F |: F, T] = new NestedAtPoint[C2, Pivot, C2.F |: F, T] {\n    def NN = C.NN\n\n    def pack[A](cc: Pivot[(C2.F |: F)#Point, T#Point[A]]): C2#Point[A] = cc.asInstanceOf[C2#Point[A]]\n    def unpack[A](cc: C2#Point[A]): Pivot[(C2.F |: F)#Point, T#Point[A]] = cc.asInstanceOf[Pivot[(C2.F |: F)#Point, T#Point[A]]]\n  }\n\n  implicit def corecurseBar2[Pivot[_[_], _, _], Z, C <: Effects, C2 <: Effects, F <: Effects, T <: Effects](implicit C2: BarExtract[C, C2], C: NestedAtPoint[C, Pivot[?[_], Z, ?], F, T]): NestedAtPoint[C2, Pivot[?[_], Z, ?], C2.F |: F, T] = corecurseBar1[Pivot[?[_], Z, ?], C, C2, F, T]\n  implicit def corecurseBar3[Pivot[_[_], _, _, _], Y, Z, C <: Effects, C2 <: Effects, F <: Effects, T <: Effects](implicit C2: BarExtract[C, C2], C: NestedAtPoint[C, Pivot[?[_], Y, Z, ?], F, T]): NestedAtPoint[C2, Pivot[?[_], Y, Z, ?], C2.F |: F, T] = corecurseBar1[Pivot[?[_], Y, Z, ?], C, C2, F, T]\n\n  // these cases are currently disabled since we have no present use for them and they slow down compilation by roughly 83%\n  /*implicit def corecursePivot1[Pivot[_[_], _], C <: Effects, C2 <: Effects, F <: Effects, T <: Effects](implicit E: PivotExtract[C, C2], C: NestedAtPoint[C, Pivot, F, T]): NestedAtPoint[C2, Pivot, E.Pivot -|: F, T] = new NestedAtPoint[C2, Pivot, E.Pivot -|: F, T] {\n    def NN = C.NN\n\n    def pack[A](cc: Pivot[(E.Pivot -|: F)#Point, T#Point[A]]): C2#Point[A] = cc.asInstanceOf[C2#Point[A]]\n    def unpack[A](cc: C2#Point[A]): Pivot[(E.Pivot -|: F)#Point, T#Point[A]] = cc.asInstanceOf[Pivot[(E.Pivot -|: F)#Point, T#Point[A]]]\n  }\n\n  implicit def corecursePivot2[Pivot[_[_], _, _], R, C <: Effects, C2 <: Effects, F <: Effects, T <: Effects](implicit E: PivotExtract[C, C2], C: NestedAtPoint[C, Pivot[?[_], R, ?], F, T]): NestedAtPoint[C2, Pivot[?[_], R, ?], E.Pivot -|: F, T] = new NestedAtPoint[C2, Pivot[?[_], R, ?], E.Pivot -|: F, T] {\n    def NN = C.NN\n\n    def pack[A](cc: Pivot[(E.Pivot -|: F)#Point, R, T#Point[A]]): C2#Point[A] = cc.asInstanceOf[C2#Point[A]]\n    def unpack[A](cc: C2#Point[A]): Pivot[(E.Pivot -|: F)#Point, R, T#Point[A]] = cc.asInstanceOf[Pivot[(E.Pivot -|: F)#Point, R, T#Point[A]]]\n  }\n\n  implicit def corecursePivot3[Pivot[_[_], _, _, _], Q, R, C <: Effects, C2 <: Effects, F <: Effects, T <: Effects](implicit E: PivotExtract[C, C2], C: NestedAtPoint[C, Pivot[?[_], Q, R, ?], F, T]): NestedAtPoint[C2, Pivot[?[_], Q, R, ?], E.Pivot -|: F, T] = new NestedAtPoint[C2, Pivot[?[_], Q, R, ?], E.Pivot -|: F, T] {\n    def NN = C.NN\n\n    def pack[A](cc: Pivot[(E.Pivot -|: F)#Point, Q, R, T#Point[A]]): C2#Point[A] = cc.asInstanceOf[C2#Point[A]]\n    def unpack[A](cc: C2#Point[A]): Pivot[(E.Pivot -|: F)#Point, Q, R, T#Point[A]] = cc.asInstanceOf[Pivot[(E.Pivot -|: F)#Point, Q, R, T#Point[A]]]\n  }*/\n}\n"
  },
  {
    "path": "core/src/main/scala/emm/properties/NonNested.scala",
    "content": "package emm\npackage properties\n\n/**\n * The property of Effects which do not contain a -|: case\n */\nsealed trait NonNested[C <: Effects] {\n  def pack[CC[_], A](cc: CC[C#Point[A]]): C#Build[CC, A]\n  def unpack[CC[_], A](cc: C#Build[CC, A]): CC[C#Point[A]]\n}\n\nobject NonNested {\n\n  implicit def base: NonNested[Base] = new NonNested[Base] {\n    def pack[CC[_], A](cc: CC[A]) = cc\n    def unpack[CC[_], A](cc: CC[A]) = cc\n  }\n\n  implicit def corecurse[C <: Effects, C2 <: Effects](implicit C2: BarExtract[C, C2], C: NonNested[C]): NonNested[C2] = new NonNested[C2] {\n    def pack[CC[_], A](cc: CC[C2#Point[A]]) = cc.asInstanceOf[C2#Build[CC, A]]\n    def unpack[CC[_], A](cc: C2#Build[CC, A]) = cc.asInstanceOf[CC[C2#Point[A]]]\n  }\n}"
  },
  {
    "path": "core/src/main/scala/emm/properties/extract.scala",
    "content": "package emm\npackage properties\n\nsealed trait BarExtract[T <: Effects, C <: Effects] {\n  type F[_]\n}\n\nobject BarExtract {\n  type Aux[T <: Effects, C <: Effects, F0[_]] = BarExtract[T, C] { type F[A] = F0[A] }\n\n  implicit def extract1[F0[_], T <: Effects]: BarExtract.Aux[T, F0 |: T, F0] = new BarExtract[T, F0 |: T] {\n    type F[A] = F0[A]\n  }\n\n  implicit def extract2[F0[_, _], F02[_, _], Z, T <: Effects](implicit ev: Permute2[F0, F02]): BarExtract.Aux[T, F02[Z, ?] |: T, F02[Z, ?]] = extract1[F02[Z, ?], T]\n  implicit def extract3[F0[_, _, _], F02[_, _, _], Y, Z, T <: Effects](implicit ev: Permute3[F0, F02]): BarExtract.Aux[T, F02[Y, Z, ?] |: T, F02[Y, Z, ?]] = extract1[F02[Y, Z, ?], T]\n\n  implicit def extractH1[F0[_[_], _], G[_], T <: Effects]: BarExtract.Aux[T, F0[G, ?] |: T, F0[G, ?]] = extract1[F0[G, ?], T]\n  implicit def extractH2[F0[_[_], _, _], F02[_[_], _, _], G[_], Z, T <: Effects](implicit ev: PermuteH2[F0, F02]): BarExtract.Aux[T, F02[G, Z, ?] |: T, F02[G, Z, ?]] = extract1[F02[G, Z, ?], T]\n  implicit def extractH3[F0[_[_], _, _, _], F02[_[_], _, _, _], G[_], Y, Z, T <: Effects](implicit ev: PermuteH3[F0, F02]): BarExtract.Aux[T, F02[G, Y, Z, ?] |: T, F02[G, Y, Z, ?]] = extract1[F02[G, Y, Z, ?], T]\n}\n\nsealed trait PivotExtract[T <: Effects, C <: Effects] {\n  type Pivot[_[_], _]\n}\n\nobject PivotExtract {\n  type Aux[T <: Effects, C <: Effects, Pivot0[_[_], _]] = PivotExtract[T, C] { type Pivot[F[_], A] = Pivot0[F, A] }\n\n  implicit def extract1[Pivot0[_[_], _], T <: Effects]: PivotExtract.Aux[T, Pivot0 -|: T, Pivot0] = new PivotExtract[T, Pivot0 -|: T] {\n    type Pivot[F[_], A] = Pivot0[F, A]\n  }\n\n  implicit def extract2[Pivot0[_[_], _, _], Z, T <: Effects]: PivotExtract.Aux[T, Pivot0[?[_], Z, ?] -|: T, Pivot0[?[_], Z, ?]] = extract1[Pivot0[?[_], Z, ?], T]\n\n  implicit def extract3[Pivot0[_[_], _, _, _], Y, Z, T <: Effects]: PivotExtract.Aux[T, Pivot0[?[_], Y, Z, ?] -|: T, Pivot0[?[_], Y, Z, ?]] = extract1[Pivot0[?[_], Y, Z, ?], T]\n}"
  },
  {
    "path": "project/Build.scala",
    "content": "import sbt._\n\nobject EmmBuild extends Build {\n  val shimsVersion = settingKey[String](\"Shims version shared between projects\")\n}"
  },
  {
    "path": "project/build.properties",
    "content": "sbt.version=0.13.9"
  },
  {
    "path": "project/plugins.sbt",
    "content": "addSbtPlugin(\"com.typesafe.sbt\" % \"sbt-git\" % \"0.8.5\")\n\naddSbtPlugin(\"org.xerial.sbt\" % \"sbt-sonatype\" % \"0.5.0\")\n"
  },
  {
    "path": "scalaz/src/main/scala/emm/compat/scalaz.scala",
    "content": "package emm\npackage compat\n\nobject scalaz extends shims.Implicits"
  },
  {
    "path": "scalaz/src/test/scala/emm/ScalazSpecs.scala",
    "content": "package emm\n\nimport emm.compat.scalaz._\n\nimport org.specs2.mutable._\n\nimport scalaz._\nimport scalaz.std.option._\nimport scalaz.std.list._\n\nobject ScalazSpecs extends Specification {\n\n  \"state stacks\" should {\n    \"implement bind\" in {\n      \"inner\" >> {\n        type E = Option |: StateT[?[_], String, ?] -|: Base\n\n         (42.pointM[E] flatMap { _ => \"foo\".pointM[E] }).run.eval(\"blah\") must beSome(\"foo\")\n       }\n\n       \"mid\" >> {\n         type E = List |: StateT[?[_], String, ?] -|: Option |: Base\n\n         (42.pointM[E] flatMap { _ => \"foo\".pointM[E] }).run.eval(\"blah\") mustEqual List(Some(\"foo\"))\n      }\n    }\n  }\n\n  \"kleisli stacks\" should {\n    \"implement bind\" in {\n      \"inner\" >> {\n        type E = Option |: Kleisli[?[_], String, ?] -|: Base\n\n         (42.pointM[E] flatMap { _ => \"foo\".pointM[E] }).run.run(\"blah\") must beSome(\"foo\")\n       }\n\n       \"mid\" >> {\n         type E = List |: Kleisli[?[_], String, ?] -|: Option |: Base\n\n         (42.pointM[E] flatMap { _ => \"foo\".pointM[E] }).run.run(\"blah\") mustEqual List(Some(\"foo\"))\n      }\n    }\n  }\n}"
  },
  {
    "path": "scalaz71/build.sbt",
    "content": "name := \"emm-scalaz-71\"\n\nlibraryDependencies += \"com.codecommit\" %% \"shims-scalaz-71\" % shimsVersion.value"
  },
  {
    "path": "scalaz72/build.sbt",
    "content": "name := \"emm-scalaz-72\"\n\nlibraryDependencies += \"com.codecommit\" %% \"shims-scalaz-72\" % shimsVersion.value"
  }
]