Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove AndThen, as StateT was fixed in Cats 1.1 #171

Merged
merged 1 commit into from
Mar 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions core/shared/src/main/scala/cats/effect/Sync.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package effect

import simulacrum._
import cats.data._
import cats.effect.internals.{AndThen, NonFatal}
import cats.effect.internals.NonFatal
import cats.syntax.all._

/**
Expand Down Expand Up @@ -176,19 +176,8 @@ object Sync {
def raiseError[A](e: Throwable): StateT[F, S, A] =
StateT.liftF(F.raiseError(e))

override def map[A, B](fa: StateT[F, S, A])(f: A => B): StateT[F, S, B] =
IndexedStateT.applyF[F, S, S, B](F.map(fa.runF) { safsba =>
AndThen(safsba).andThen(fa => F.map(fa) { case (s, a) => (s, f(a)) })
})

def flatMap[A, B](fa: StateT[F, S, A])(f: A => StateT[F, S, B]): StateT[F, S, B] =
IndexedStateT.applyF[F, S, S, B](F.map(fa.runF) { safsba =>
AndThen(safsba).andThen { fsba =>
F.flatMap(fsba) { case (sb, a) =>
f(a).run(sb)
}
}
})
fa.flatMap(f)

// overwriting the pre-existing one, since flatMap is guaranteed stack-safe
def tailRecM[A, B](a: A)(f: A => StateT[F, S, Either[A, B]]): StateT[F, S, B] =
Expand Down
134 changes: 0 additions & 134 deletions core/shared/src/main/scala/cats/effect/internals/AndThen.scala

This file was deleted.

This file was deleted.