diff --git a/core/src/main/scala/cats/data/Validated.scala b/core/src/main/scala/cats/data/Validated.scala index c9dec92957..664a2dc86b 100644 --- a/core/src/main/scala/cats/data/Validated.scala +++ b/core/src/main/scala/cats/data/Validated.scala @@ -38,15 +38,6 @@ sealed abstract class Validated[+E, +A] extends Product with Serializable { */ def forall(f: A => Boolean): Boolean = fold(_ => true, f) - /** - * If the value is Valid but the predicate fails, return an empty - * Invalid value, otherwise leaves the value unchanged. This method - * is mostly useful for allowing validated values to be used in a - * for comprehension with pattern matching. - */ - def filter[EE >: E](pred: A => Boolean)(implicit M: Monoid[EE]): Validated[EE,A] = - fold(Invalid.apply, a => if(pred(a)) this else Invalid(M.empty)) - /** * Return this if it is Valid, or else fall back to the given default. */ diff --git a/tests/src/test/scala/cats/tests/ValidatedTests.scala b/tests/src/test/scala/cats/tests/ValidatedTests.scala index 3c9ae4d103..50c30dff57 100644 --- a/tests/src/test/scala/cats/tests/ValidatedTests.scala +++ b/tests/src/test/scala/cats/tests/ValidatedTests.scala @@ -47,14 +47,6 @@ class ValidatedTests extends CatsSuite { } } - test("filter makes non-matching entries invalid") { - Valid(1).filter[String](_ % 2 == 0).isInvalid should ===(true) - } - - test("filter leaves matching entries valid") { - Valid(2).filter[String](_ % 2 == 0).isValid should ===(true) - } - test("ValidatedNel") { forAll { (e: String) => val manual = Validated.invalid[NonEmptyList[String], Int](NonEmptyList(e))