From 5a1bd6181c3a734b430fbe89f77c5b9cf1bac82f Mon Sep 17 00:00:00 2001 From: Lars Hupel Date: Sat, 8 Feb 2014 18:10:52 +0100 Subject: [PATCH] nuke deprecated MetricSpace and BKTree --- core/src/main/scala/scalaz/BKTree.scala | 201 ------------------ core/src/main/scala/scalaz/MetricSpace.scala | 94 -------- core/src/main/scala/scalaz/package.scala | 1 - core/src/main/scala/scalaz/std/AnyVal.scala | 6 - .../scalaz/syntax/MetricSpaceSyntax.scala | 31 --- .../src/main/scala/scalaz/syntax/Syntax.scala | 5 +- etc/CREDITS | 35 --- project/GenTypeClass.scala | 1 - .../scalaz/scalacheck/ScalazArbitrary.scala | 4 - .../scalaz/scalacheck/ScalazProperties.scala | 16 -- tests/src/test/scala/scalaz/BKTreeTest.scala | 46 ---- .../test/scala/scalaz/LevenshteinTest.scala | 13 -- .../test/scala/scalaz/std/AnyValTest.scala | 6 - 13 files changed, 1 insertion(+), 458 deletions(-) delete mode 100644 core/src/main/scala/scalaz/BKTree.scala delete mode 100644 core/src/main/scala/scalaz/MetricSpace.scala delete mode 100644 core/src/main/scala/scalaz/syntax/MetricSpaceSyntax.scala delete mode 100644 tests/src/test/scala/scalaz/BKTreeTest.scala delete mode 100644 tests/src/test/scala/scalaz/LevenshteinTest.scala diff --git a/core/src/main/scala/scalaz/BKTree.scala b/core/src/main/scala/scalaz/BKTree.scala deleted file mode 100644 index 44c0b2a51f..0000000000 --- a/core/src/main/scala/scalaz/BKTree.scala +++ /dev/null @@ -1,201 +0,0 @@ -package scalaz - -import collection.immutable.IntMap -import annotation.tailrec - - -/** - * Burkhard-Keller trees provide an implementation of sets which apart - * from the ordinary operations also has an approximate member search, - * allowing you to search for elements that are of a distance `n` from - * the element you are searching for. The distance is determined using - * a metric on the type of elements. Therefore all elements must - * implement the [[scalaz.MetricSpace]] type class, rather than the more usual - * [[scalaz.Ordering]]. - * - * The worst case complexity of many of these operations is quite bad, - * but the expected behavior varies greatly with the metric. For - * example, the discrete metric (`distance x y | y == x = 0 | - * otherwise = 1`) makes BK-trees behave abysmally. The metrics - * mentioned above should give good performance characteristics. - * - * This implementation is a port of Haskell's [[http://hackage.haskell.org/packages/archive/bktrees/0.2.1/doc/html/src/Data-Set-BKTree.html Data.Set.BKTree]] - */ -@deprecated("This class depends on `MetricSpace` which is deprecated, too.", "7.0.1") -sealed abstract class BKTree[A] extends Product with Serializable { - def isEmpty: Boolean = - this match { - case BKTreeEmpty() => true - case BKTreeNode(_, _, _) => false - } - - def map[B](f: A => B): BKTree[B] = - this match { - case BKTreeEmpty() => BKTreeEmpty() - case BKTreeNode(a, s, c) => BKTreeNode(f(a), s, c.transform((_: Int, z: BKTree[A]) => z map f)) - } - - def size: Int = - this match { - case BKTreeEmpty() => 0 - case BKTreeNode(_, s, _) => s - } - - def +(a: A)(implicit A: MetricSpace[A]): BKTree[A] = - this match { - case BKTreeEmpty() => BKTreeNode(a, 1, IntMap.empty) - case BKTreeNode(v, s, c) => { - val d = A.distance(v, a) - BKTreeNode(v, s + 1, c + ((d, c get d match { - case None => BKTreeNode(a, 1, IntMap.empty) - case Some(w) => w + a - }))) - } - } - - def ++(t: BKTree[A])(implicit m: MetricSpace[A]): BKTree[A] = { - var k: BKTree[A] = this - for (v <- t.values) - k = k + v - k - } - - def -(a: A)(implicit A: MetricSpace[A]): BKTree[A] = - this match { - case BKTreeEmpty() => BKTreeEmpty() - case BKTreeNode(v, _, c) => { - val d = A.distance(v, a) - if(d == 0) BKTree(c.values.seq.flatMap(_.values).toSeq: _*) - else { - val subTree = updateMap(c, d, (t: BKTree[A]) => Some(t - a)) - val size = subTree.values.map(_.size).sum + 1 - BKTreeNode(v, size, subTree) - } - } - } - - def --(t: BKTree[A])(implicit m: MetricSpace[A]): BKTree[A] = { - var k: BKTree[A] = this - for (v <- t.values) - k = k - v - k - } - - def values: List[A] = - this match { - case BKTreeEmpty() => Nil - case BKTreeNode(v, _, c) => v :: c.valuesIterator.toList.flatMap(_.values) - } - - - /** - * Returns true of this set contains `a`. - */ - @tailrec - final def contains(a: A)(implicit A: MetricSpace[A]): Boolean = - this match { - case BKTreeEmpty() => false - case BKTreeNode(v, _, c) => - val d = A.distance(v, a) - d == 0 || (c get d match { - case None => false - case Some(w) => w contains a - }) - } - - /** An alias for `contains` */ - final def -?-(a: A)(implicit A: MetricSpace[A]): Boolean = contains(a) - - /** Returns true if this set contains an element which has a distance from `a` that is less than or equal to `n` */ - def containsApproximate(a: A, n: Int)(implicit A: MetricSpace[A]): Boolean = - this match { - case BKTreeEmpty() => false - case BKTreeNode(v, _, c) => - val d = A.distance(v, a) - d <= n || (subChildren(d, n) exists (_._2 containsApproximate(a, n))) - } - - /** An alias for `containsApproximate` */ - def =?=(a: A, n: Int)(implicit A: MetricSpace[A]): Boolean = containsApproximate(a, n) - - /** Returns the elements which have an distance from `a` that is less than or equal to `n`. */ - def valuesApproximate(a: A, n: Int)(implicit A: MetricSpace[A]): List[A] = - this match { - case BKTreeEmpty() => Nil - case BKTreeNode(v, _, c) => - val d = A.distance(v, a) - val k = subChildren(d, n).valuesIterator.toList flatMap (_ valuesApproximate(a, n)) - if (d <= n) - v :: k - else - k - } - - /** An alias for `valuesApproximate` */ - def |=|(a: A, n: Int)(implicit A: MetricSpace[A]): List[A] = valuesApproximate(a, n) - - private type M[A] = IntMap[A] - - private def subChildren(d: Int, n: Int): M[BKTree[A]] = - this match { - case BKTreeEmpty() => IntMap.empty - case BKTreeNode(_, _, c) => subMap(c, d, n) - } - - private def subMap(m: M[BKTree[A]], d: Int, n: Int): M[BKTree[A]] = - splitMap(splitMap(m, d - n - 1)._2, d + n + 1)._1 - - private def splitChildren(k: Int): (M[BKTree[A]], M[BKTree[A]]) = - this match { - case BKTreeEmpty() => (IntMap.empty, IntMap.empty) - case BKTreeNode(_, _, c) => splitMap(c, k) - } - - private def splitMap(m: M[BKTree[A]], k: Int): (M[BKTree[A]], M[BKTree[A]]) = { - var m1: M[BKTree[A]] = IntMap.empty - var m2: M[BKTree[A]] = IntMap.empty - for ((i, v) <- m.iterator) { - if (i < k) - m1 = m1 + ((i, v)) - else if (i > k) - m2 = m2 + ((i, v)) - } - (m1, m2) - } - - private def updateMap(m: M[BKTree[A]], k: Int, f: BKTree[A] => Option[BKTree[A]]) = - m get k match { - case None => m - case Some(v) => f(v) match { - case None => m - k - case Some(value) => m.updated(k, value) - } - } -} - -private case class BKTreeNode[A](value: A, sz: Int, children: IntMap[BKTree[A]]) extends BKTree[A] - -private case class BKTreeEmpty[A]() extends BKTree[A] - -object BKTree extends BKTreeInstances with BKTreeFunctions { - def apply[A: MetricSpace](as: A*): BKTree[A] = as.foldLeft(emptyBKTree[A])((b, a) => b + a) -} - -trait BKTreeFunctions { - def emptyBKTree[A]: BKTree[A] = BKTreeEmpty() -} - -sealed abstract class BKTreeInstances { - implicit def bKTreeInstance: Functor[BKTree] with Length[BKTree] = new Functor[BKTree] with Length[BKTree] { - def map[A, B](fa: BKTree[A])(f: A => B): BKTree[B] = fa map f - def length[A](fa: BKTree[A]): Int = fa.size - } - implicit def bKTreeMonoid[A: MetricSpace]: Monoid[BKTree[A]] = new Monoid[BKTree[A]] { - def append(f1: BKTree[A], f2: => BKTree[A]): BKTree[A] = f1 ++ f2 - def zero: BKTree[A] = BKTree[A]() - } - implicit def bkTreeEqual[A](implicit A: Equal[A]) = { - import std.list._ - Equal.equalBy((ba: BKTree[A]) => ba.values) - } -} diff --git a/core/src/main/scala/scalaz/MetricSpace.scala b/core/src/main/scala/scalaz/MetricSpace.scala deleted file mode 100644 index 57138ef88e..0000000000 --- a/core/src/main/scala/scalaz/MetricSpace.scala +++ /dev/null @@ -1,94 +0,0 @@ -package scalaz - -//// -/** - * Useful metric spaces include the manhattan distance between two points, - * the Levenshtein edit distance between two strings, the number of - * edges in the shortest path between two nodes in an undirected graph - * and the Hamming distance between two binary strings. Any euclidean - * space also has a metric. However, in this module we use int-valued - * metrics and that's not compatible with the metrics of euclidean - * spaces which are real-values. - * - * @see [[scalaz.BKTree]] - */ -//// -@deprecated("Redundant to spire's `MetricSpace`", "7.0.1") -trait MetricSpace[F] { self => - //// - def distance(a: F, b: F): Int - - def contramap[B](f: B => F): MetricSpace[B] = new MetricSpace[B] { - def distance(a: B, b: B): Int = self.distance(f(a), f(b)) - } - - // derived functions - - trait MetricSpaceLaw { - - import std.boolean.conditional - - def nonNegativity(a1: F, a2: F): Boolean = distance(a1, a1) >= 0 - def identity(a1: F): Boolean = distance(a1, a1) == 0 - def equality(a1: F, a2: F)(implicit F: Equal[F]): Boolean = conditional(F.equal(a1, a2), distance(a1, a2) == 0) - def symmetry(a1: F, a2: F): Boolean = distance(a1, a2) == distance(a2, a1) - def triangleInequality(a1: F, a2: F, a3: F): Boolean = (distance(a1, a2) + distance(a2, a3)) >= distance(a1, a3) - } - - def metricSpaceLaw = new MetricSpaceLaw {} - - //// - val metricSpaceSyntax = new scalaz.syntax.MetricSpaceSyntax[F] { def F = MetricSpace.this } -} - -object MetricSpace { - @inline def apply[F](implicit F: MetricSpace[F]): MetricSpace[F] = F - - //// - val metricSpaceInstance = new Contravariant[MetricSpace] { - def contramap[A, B](r: MetricSpace[A])(f: B => A): MetricSpace[B] = r contramap f - } - - def metricSpace[A](f: (A, A) => Int): MetricSpace[A] = new MetricSpace[A] { - def distance(a1: A, a2: A): Int = f(a1, a2) - } - - def levenshtein[F[_], A](implicit l: Length[F], i: Index[F], e: Equal[A]): MetricSpace[F[A]] = new MetricSpace[F[A]] { - def distance(a1: F[A], a2: F[A]): Int = levenshteinDistance(a1, a2) - } - - def levenshteinDistance[F[_], A](value: F[A], w: F[A])(implicit l: Length[F], ind: Index[F], equ: Equal[A]): Int = { - import Memo._ - def levenshteinMatrix(w: F[A])(implicit l: Length[F], ind: Index[F], equ: Equal[A]): (Int, Int) => Int = { - val m = mutableHashMapMemo[(Int, Int), Int] - - def get(i: Int, j: Int): Int = if (i == 0) j - else if (j == 0) i - else { - lazy val t: A = ind.index(value, (i - 1)).get - lazy val u: A = ind.index(w, (j - 1)).get - lazy val e: Boolean = equ.equal(t, u) - - - val g: ((Int, Int)) => Int = m { - case (a, b) => get(a, b) - } - val a: Int = g((i - 1, j)) + 1 - val b: Int = g((i - 1, j - 1)) + (if (e) 0 else 1) - def c: Int = g((i, j - 1)) + 1 - if (a < b) a else if (b <= c) b else c - } - - get - } - - val k = levenshteinMatrix(w) - k(l.length(value), l.length(w)) - } - - implicit def LevenshteinString: MetricSpace[String] = { - import std.list._, std.anyVal._ - levenshtein[List, Char].contramap((s: String) => s.toList) - } - //// -} diff --git a/core/src/main/scala/scalaz/package.scala b/core/src/main/scala/scalaz/package.scala index 4815239fe7..9b5117762a 100644 --- a/core/src/main/scala/scalaz/package.scala +++ b/core/src/main/scala/scalaz/package.scala @@ -22,7 +22,6 @@ * - [[scalaz.Order]] extends [[scalaz.Equal]] * - [[scalaz.Enum]] extends [[scalaz.Order]] * - * - [[scalaz.MetricSpace]] * - [[scalaz.Plus]] * - [[scalaz.PlusEmpty]] extends [[scalaz.Plus]] * - [[scalaz.IsEmpty]] extends [[scalaz.PlusEmpty]] diff --git a/core/src/main/scala/scalaz/std/AnyVal.scala b/core/src/main/scala/scalaz/std/AnyVal.scala index 9e0b5d6989..3b6d635ece 100644 --- a/core/src/main/scala/scalaz/std/AnyVal.scala +++ b/core/src/main/scala/scalaz/std/AnyVal.scala @@ -250,12 +250,6 @@ trait AnyValInstances { override def equalIsNatural: Boolean = true } - /** Warning: the triangle inequality will not hold if `b - a` overflows. */ - @deprecated("MetricSpace is deprecated", "7.0.1") - implicit val intMetricSpace: MetricSpace[Int] = new MetricSpace[Int] { - def distance(a: Int, b: Int): Int = scala.math.abs(b - a) - } - implicit val intMultiplicationNewType: Monoid[Int @@ Multiplication] with Enum[Int @@ Multiplication] = new Monoid[Int @@ Multiplication] with Enum[Int @@ Multiplication] { def append(f1: Int @@ Multiplication, f2: => Int @@ Multiplication) = Multiplication(Tag.unwrap(f1) * Tag.unwrap(f2)) diff --git a/core/src/main/scala/scalaz/syntax/MetricSpaceSyntax.scala b/core/src/main/scala/scalaz/syntax/MetricSpaceSyntax.scala deleted file mode 100644 index 46a71b4587..0000000000 --- a/core/src/main/scala/scalaz/syntax/MetricSpaceSyntax.scala +++ /dev/null @@ -1,31 +0,0 @@ -package scalaz -package syntax - -/** Wraps a value `self` and provides methods related to `MetricSpace` */ -@deprecated("MetricSpace is deprecated", "7.0.1") -trait MetricSpaceOps[F] extends Ops[F] { - implicit def F: MetricSpace[F] - //// - final def <===>(a: F): Int = F.distance(self, a) - //// -} - -@deprecated("MetricSpace is deprecated", "7.0.1") -trait ToMetricSpaceOps { - implicit def ToMetricSpaceOps[F](v: F)(implicit F0: MetricSpace[F]) = - new MetricSpaceOps[F] { def self = v; implicit def F: MetricSpace[F] = F0 } - - //// - - //// -} - -@deprecated("MetricSpace is deprecated", "7.0.1") -trait MetricSpaceSyntax[F] { - implicit def ToMetricSpaceOps(v: F): MetricSpaceOps[F] = new MetricSpaceOps[F] { def self = v; implicit def F: MetricSpace[F] = MetricSpaceSyntax.this.F } - - def F: MetricSpace[F] - //// - - //// -} diff --git a/core/src/main/scala/scalaz/syntax/Syntax.scala b/core/src/main/scala/scalaz/syntax/Syntax.scala index 2ddf1ef00d..174588d0a6 100644 --- a/core/src/main/scala/scalaz/syntax/Syntax.scala +++ b/core/src/main/scala/scalaz/syntax/Syntax.scala @@ -22,9 +22,6 @@ trait Syntaxes { object enum extends ToEnumOps - @deprecated("metricSpace is deprecated", "7.0.1") - object metricSpace extends ToMetricSpaceOps - object isEmpty extends ToIsEmptyOps object plusEmpty extends ToPlusEmptyOps @@ -161,7 +158,7 @@ trait ToDataOps trait ToTypeClassOps extends ToSemigroupOps with ToMonoidOps with ToEqualOps with ToLengthOps with ToShowOps - with ToOrderOps with ToEnumOps with ToMetricSpaceOps with ToPlusEmptyOps with ToEachOps with ToIndexOps + with ToOrderOps with ToEnumOps with ToPlusEmptyOps with ToEachOps with ToIndexOps with ToFunctorOps with ToContravariantOps with ToApplyOps with ToApplicativeOps with ToBindOps with ToMonadOps with ToComonadOps with ToBifoldableOps with ToCozipOps diff --git a/etc/CREDITS b/etc/CREDITS index fbf2e3cb62..a5977d1618 100644 --- a/etc/CREDITS +++ b/etc/CREDITS @@ -33,41 +33,6 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -Data.Set.BKTree -=============== - -Copyright Josef Svenningsson 2007 - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * Neither the name of Josef Svenningsson nor the names of other - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - Data.DList ========== diff --git a/project/GenTypeClass.scala b/project/GenTypeClass.scala index 381c80b0fb..38ec1e2da1 100644 --- a/project/GenTypeClass.scala +++ b/project/GenTypeClass.scala @@ -21,7 +21,6 @@ object TypeClass { lazy val show = TypeClass("Show", *) lazy val order = TypeClass("Order", *, extendsList = Seq(equal)) lazy val enum = TypeClass("Enum", *, extendsList = Seq(order)) - lazy val metricSpace = TypeClass("MetricSpace", *) lazy val invariantFunctor = TypeClass("InvariantFunctor", *->*) lazy val functor = TypeClass("Functor", *->*, extendsList = Seq(invariantFunctor)) diff --git a/scalacheck-binding/src/main/scala/scalaz/scalacheck/ScalazArbitrary.scala b/scalacheck-binding/src/main/scala/scalaz/scalacheck/ScalazArbitrary.scala index 0df3f8b086..41f88c2d36 100644 --- a/scalacheck-binding/src/main/scala/scalaz/scalacheck/ScalazArbitrary.scala +++ b/scalacheck-binding/src/main/scala/scalaz/scalacheck/ScalazArbitrary.scala @@ -282,10 +282,6 @@ object ScalazArbitrary { Functor[Arbitrary].map(A)(as => InsertionMap(as: _*)) } - @deprecated("BKTree is deprecated", "7.0.1") - implicit def bkTreeArbitrary[A](implicit A: MetricSpace[A], arb: Arbitrary[List[A]]): Arbitrary[BKTree[A]] = - Functor[Arbitrary].map(arb)(as => BKTree[A](as: _*)) - // backwards compatability def storeTArb[F[+_], A, B](implicit A: Arbitrary[(F[A => B], A)]): Arbitrary[StoreT[F, A, B]] = indexedStoreTArb[F, A, A, B](A) diff --git a/scalacheck-binding/src/main/scala/scalaz/scalacheck/ScalazProperties.scala b/scalacheck-binding/src/main/scala/scalaz/scalacheck/ScalazProperties.scala index 8973c370bf..7d887f99c1 100644 --- a/scalacheck-binding/src/main/scala/scalaz/scalacheck/ScalazProperties.scala +++ b/scalacheck-binding/src/main/scala/scalaz/scalacheck/ScalazProperties.scala @@ -503,22 +503,6 @@ object ScalazProperties { } } - @deprecated("MetricSpace is deprecated", "7.0.1") - object metricSpace { - def nonNegativity[F](implicit F: MetricSpace[F], af: Arbitrary[F]) = forAll(F.metricSpaceLaw.nonNegativity _) - def identity[F](implicit F: MetricSpace[F], af: Arbitrary[F]) = forAll(F.metricSpaceLaw.identity _) - def equality[F](implicit F: MetricSpace[F], E: Equal[F], af: Arbitrary[F]) = forAll(F.metricSpaceLaw.equality _) - def symmetry[F](implicit F: MetricSpace[F], af: Arbitrary[F]) = forAll(F.metricSpaceLaw.symmetry _) - def triangleInequality[F](implicit F: MetricSpace[F], af: Arbitrary[F]) = forAll(F.metricSpaceLaw.triangleInequality _) - def laws[F](implicit F: MetricSpace[F], E: Equal[F], af: Arbitrary[F]) = new Properties("metric space") { - property("nonNegativity") = nonNegativity[F] - property("identity") = identity[F] - property("equality") = equality[F] - property("symmetry") = symmetry[F] - property("triangleInequality") = triangleInequality[F] - } - } - object monadError { def raisedErrorsHandled[F[_, _], E, A](implicit me: MonadError[F, E], eq: Equal[F[E, A]], ae: Arbitrary[E], afea: Arbitrary[E => F[E,A]]) = forAll(me.monadErrorLaw.raisedErrorsHandled[A] _) diff --git a/tests/src/test/scala/scalaz/BKTreeTest.scala b/tests/src/test/scala/scalaz/BKTreeTest.scala deleted file mode 100644 index c94025e264..0000000000 --- a/tests/src/test/scala/scalaz/BKTreeTest.scala +++ /dev/null @@ -1,46 +0,0 @@ -package scalaz - -import scalaz.scalacheck.ScalazProperties._ -import scalaz.scalacheck.ScalazArbitrary._ -import std.AllInstances._ -import scalaz.scalacheck.ScalaCheckBinding._ -import org.scalacheck.{Arbitrary, Gen} -import org.scalacheck.Prop.forAll - - -object BKTreeTest extends SpecLite { - implicit val IntArb = Arbitrary[Int](Gen.choose(Int.MinValue / 4, Int.MaxValue / 4)) - - "string distance" in { - BKTree[String]("kitten").containsApproximate("sitting", 3) - } - - "empty" ! forAll { - (a: String) => !BKTree[String]().contains(a) - } - - "singleton" ! forAll { - (a: String) => BKTree[String](a).contains(a) - } - - "contains" ! forAll { - (a: String, as: Set[String]) => BKTree[String](as.toSeq: _*).contains(a) == as.contains(a) - } - - "values" ! forAll { - (as: Set[String]) => BKTree[String](as.toSeq: _*).values.toSet == as - } - - "+ and -" ! forAll { - (a:String, as: Set[String]) => (BKTree[String](as.toSeq: _*) + a - a).values.toSet == as - } - - "isEmpty" ! forAll { - (as: Set[String]) => BKTree[String](as.toSeq: _*).isEmpty == as.isEmpty - } - - // TODO more tests - - checkAll(functor.laws[BKTree]) - checkAll(monoid.laws[BKTree[Int]]) -} diff --git a/tests/src/test/scala/scalaz/LevenshteinTest.scala b/tests/src/test/scala/scalaz/LevenshteinTest.scala deleted file mode 100644 index 8adf6d2366..0000000000 --- a/tests/src/test/scala/scalaz/LevenshteinTest.scala +++ /dev/null @@ -1,13 +0,0 @@ -package scalaz - -import scalaz.scalacheck.ScalazProperties._ -import std.AllInstances._ -import org.scalacheck.Prop.forAll - -object LevenshteinTest extends SpecLite { - "string distance" in { - MetricSpace[String].distance("kitten", "sitting") must_===(3) - } - - checkAll(metricSpace.laws[String]) -} diff --git a/tests/src/test/scala/scalaz/std/AnyValTest.scala b/tests/src/test/scala/scalaz/std/AnyValTest.scala index bf0573e4e1..c98eaab96a 100644 --- a/tests/src/test/scala/scalaz/std/AnyValTest.scala +++ b/tests/src/test/scala/scalaz/std/AnyValTest.scala @@ -41,12 +41,6 @@ object AnyValTest extends SpecLite { checkAll("Short", monoid.laws[Short]) checkAll("Long", monoid.laws[Long]) - { - implicit val IntArb = Arbitrary[Int](Gen.choose(Int.MinValue / 4, Int.MaxValue / 4)) - - checkAll("Int", metricSpace.laws[Int]) - } - checkAll("Unit", enum.laws[Unit]) checkAll("Boolean", enum.laws[Boolean]) checkAll("Char", enum.laws[Char])