Skip to content

Commit

Permalink
Remove arrow instance
Browse files Browse the repository at this point in the history
  • Loading branch information
Itamar Ravid committed Sep 11, 2017
1 parent 3151311 commit 53ea464
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 37 deletions.
27 changes: 0 additions & 27 deletions core/src/main/scala/cats/data/IndexedStateT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,6 @@ private[data] sealed abstract class IndexedStateTInstances4 extends IndexedState
new IndexedStateTStrong[F, V] { implicit def F = F0 }
}

private[data] sealed abstract class IndexedStateTInstances5 {
implicit def catsDataArrowForIndexedStateT[F[_], V](implicit F0: Monad[F], V0: Monoid[V]): Arrow[IndexedStateT[F, ?, ?, V]] =
new IndexedStateTArrow[F, V] { implicit def F = F0; implicit def V = V0 }
}

// To workaround SI-7139 `object State` needs to be defined inside the package object
// together with the type alias.
private[data] abstract class StateFunctions {
Expand Down Expand Up @@ -337,28 +332,6 @@ private[data] sealed abstract class IndexedStateTStrong[F[_], V] extends Indexed
first(fa).dimap((_: (C, A)).swap)(_.swap)
}

private[data] sealed abstract class IndexedStateTArrow[F[_], V] extends IndexedStateTStrong[F, V] with Arrow[IndexedStateT[F, ?, ?, V]] {
implicit def F: Monad[F]
implicit def V: Monoid[V]

def lift[A, B](f: A => B): IndexedStateT[F, A, B, V] =
IndexedStateT { a =>
F.pure((f(a), V.empty))
}

def id[A]: IndexedStateT[F, A, A, V] =
IndexedStateT.pure(V.empty)

def compose[A, B, C](f: IndexedStateT[F, B, C, V], g: IndexedStateT[F, A, B, V]): IndexedStateT[F, A, C, V] =
IndexedStateT { a =>
F.flatMap(g.run(a)) { case (b, va) =>
F.map(f.run(b)) { case (c, vb) =>
(c, V.combine(va, vb))
}
}
}
}

private[data] sealed abstract class IndexedStateTMonad[F[_], S] extends IndexedStateTFunctor[F, S, S] with Monad[IndexedStateT[F, S, S, ?]] {
implicit def F: Monad[F]

Expand Down
10 changes: 0 additions & 10 deletions tests/src/test/scala/cats/tests/IndexedStateTTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -322,16 +322,6 @@ class IndexedStateTTests extends CatsSuite {
Strong[IndexedStateT[ListWrapper, ?, ?, Int]]
}

{
implicit val F: Monad[ListWrapper] = ListWrapper.monad
implicit val FS: Arrow[IndexedStateT[ListWrapper, ?, ?, Int]] = IndexedStateT.catsDataArrowForIndexedStateT

checkAll("IndexedStateT[ListWrapper, String, Int, Int]", ArrowTests[IndexedStateT[ListWrapper, ?, ?, Int]].arrow[String, String, String, Int, Int, Int])
checkAll("Arrow[IndexedStateT[ListWrapper, ?, ?, Int]]", SerializableTests.serializable(Arrow[IndexedStateT[ListWrapper, ?, ?, Int]]))

Arrow[IndexedStateT[ListWrapper, ?, ?, Int]]
}

{
// F has a Monad
implicit val F = ListWrapper.monad
Expand Down

0 comments on commit 53ea464

Please sign in to comment.