Skip to content

Commit

Permalink
Exclude extra methods from Simulacrum syntax generation
Browse files Browse the repository at this point in the history
  • Loading branch information
travisbrown committed Mar 11, 2020
1 parent 4f6d5c2 commit 69d91a0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions core/src/main/scala/cats/FlatMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ import simulacrum.noop
/**
* `if` lifted into monad.
*/
@noop
def ifM[B](fa: F[Boolean])(ifTrue: => F[B], ifFalse: => F[B]): F[B] =
flatMap(fa)(if (_) ifTrue else ifFalse)

Expand Down
1 change: 1 addition & 0 deletions core/src/main/scala/cats/Functor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ import simulacrum.{noop, typeclass}
* res0: List[Int] = List(1, 0, 0)
* }}}
*/
@noop
def ifF[A](fb: F[Boolean])(ifTrue: => A, ifFalse: => A): F[A] = map(fb)(x => if (x) ifTrue else ifFalse)

def compose[G[_]: Functor]: Functor[λ[α => F[G[α]]]] =
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/scala/cats/Monad.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cats

import simulacrum.typeclass
import simulacrum.{noop, typeclass}

/**
* Monad.
Expand All @@ -22,6 +22,7 @@ import simulacrum.typeclass
* This implementation uses append on each evaluation result,
* so avoid data structures with non-constant append performance, e.g. `List`.
*/
@noop
def whileM[G[_], A](p: F[Boolean])(body: => F[A])(implicit G: Alternative[G]): F[G[A]] = {
val b = Eval.later(body)
tailRecM[G[A], G[A]](G.empty)(xs =>
Expand All @@ -41,6 +42,7 @@ import simulacrum.typeclass
* returns `true`. The condition is evaluated before the loop body.
* Discards results.
*/
@noop
def whileM_[A](p: F[Boolean])(body: => F[A]): F[Unit] = {
val continue: Either[Unit, Unit] = Left(())
val stop: F[Either[Unit, Unit]] = pure(Right(()))
Expand Down

0 comments on commit 69d91a0

Please sign in to comment.