Skip to content

Commit 102654b

Browse files
committed
Dropped Ordering bound on the values in cogenMap
It's safe to sort only by the keys, because they are distinct. Fixes #356
1 parent c062f37 commit 102654b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/scala/org/scalacheck/Cogen.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ object Cogen extends CogenArities with CogenLowPriority {
126126
implicit def cogenSet[A: Cogen: Ordering]: Cogen[Set[A]] =
127127
Cogen.it(_.toVector.sorted.iterator)
128128

129-
implicit def cogenMap[K: Cogen: Ordering, V: Cogen: Ordering]: Cogen[Map[K, V]] =
130-
Cogen.it(_.toVector.sorted.iterator)
129+
implicit def cogenMap[K: Cogen: Ordering, V: Cogen]: Cogen[Map[K, V]] =
130+
Cogen.it(_.toVector.sortBy(_._1).iterator)
131131

132132
implicit def cogenFunction0[Z: Cogen]: Cogen[() => Z] =
133133
Cogen[Z].contramap(f => f())

0 commit comments

Comments
 (0)