From 6bbe582bd3f18377f686386e28bf1cafdb304079 Mon Sep 17 00:00:00 2001 From: Cody Allen Date: Mon, 28 Sep 2015 07:31:07 -0400 Subject: [PATCH] Fix monoid zeros for Float/Double Fixes #301. This was ignored for far too long (even though there was #301 for it). We should really have test coverage on this. I say we merge this for now but discuss whether this should just be coming from algebra and add tests to whichever project it comes from. --- core/src/main/scala/cats/std/anyval.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/scala/cats/std/anyval.scala b/core/src/main/scala/cats/std/anyval.scala index 5588593ab4..7964aa18e9 100644 --- a/core/src/main/scala/cats/std/anyval.scala +++ b/core/src/main/scala/cats/std/anyval.scala @@ -95,7 +95,7 @@ trait FloatInstances /* missing algebra type classes */ { implicit val floatAlgebra: CommutativeGroup[Float] with Order[Float] = new CommutativeGroup[Float] with Order[Float] { def combine(x: Float, y: Float): Float = x + y - def empty: Float = 1F + def empty: Float = 0F def inverse(x: Float): Float = -x def compare(x: Float, y: Float): Int = java.lang.Float.compare(x, y) @@ -112,7 +112,7 @@ trait DoubleInstances /* missing algebra type classes */ { implicit val doubleAlgebra: CommutativeGroup[Double] with Order[Double] = new CommutativeGroup[Double] with Order[Double] { def combine(x: Double, y: Double): Double = x + y - def empty: Double = 1D + def empty: Double = 0D def inverse(x: Double): Double = -x def compare(x: Double, y: Double): Int = java.lang.Double.compare(x, y)