Skip to content

Commit

Permalink
Remove sequential laws
Browse files Browse the repository at this point in the history
  • Loading branch information
kubukoz committed Aug 1, 2019
1 parent 911a30f commit 423d4b1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
10 changes: 1 addition & 9 deletions core/src/main/scala/cats/mtl/MonadState.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@ package mtl
* }
* }}}
*
* `MonadState` has five internal laws:
* `MonadState` has three internal laws:
* {{{
* def modifyIsGetThenSet(f: S => S) = {
* modify(f) <-> (inspect(f) flatMap set)
* }
*
* def setIsStateUnit(s: S) = {
* set(s) <-> state(_ => (s, ()))
* }
Expand All @@ -39,10 +35,6 @@ package mtl
* def modifyIsState(f: S => S) = {
* modify(f) <-> state(s => (f(s), ()))
* }
*
* def stateIsGetAndModify[A](f: S => (S, A)) = {
* state(f) <-> (get.map(old => f(old)._2) <* modify(old => f(old)._1))
* }
* }}}
*
*/
Expand Down
9 changes: 0 additions & 9 deletions laws/src/main/scala/cats/mtl/laws/MonadStateLaws.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package laws

import cats.laws.IsEq
import cats.laws.IsEqArrow
import cats.syntax.functor._
import cats.syntax.flatMap._
import cats.syntax.apply._

Expand Down Expand Up @@ -33,10 +32,6 @@ trait MonadStateLaws[F[_], S] {
}

// internal laws:
def modifyIsGetThenSet(f: S => S): IsEq[F[Unit]] = {
modify(f) <-> ((get map f) flatMap set)
}

def setIsStateUnit(s: S): IsEq[F[Unit]] = {
set(s) <-> state(_ => (s, ()))
}
Expand All @@ -48,10 +43,6 @@ trait MonadStateLaws[F[_], S] {
def modifyIsState(f: S => S): IsEq[F[Unit]] = {
modify(f) <-> state(s => (f(s), ()))
}

def stateIsGetAndModify[A](f: S => (S, A)): IsEq[F[A]] = {
state(f) <-> (get.map(old => f(old)._2) <* modify(old => f(old)._1))
}
}

object MonadStateLaws {
Expand Down

0 comments on commit 423d4b1

Please sign in to comment.