Skip to content

Commit

Permalink
Add Cogen.domainOf
Browse files Browse the repository at this point in the history
  • Loading branch information
nigredo-tori committed Feb 11, 2021
1 parent cade049 commit 17d2e64
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/scala/org/scalacheck/Cogen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ object Cogen extends CogenArities with CogenLowPriority with CogenVersionSpecifi
while (i < as.length) { s = A.perturb(s, as(i)); i += 1 }
s.next
}

def domainOf[A, B](f: A => B)(implicit B: Cogen[B]): Cogen[A] = B.contramap(f)
}

trait CogenLowPriority {
Expand Down

0 comments on commit 17d2e64

Please sign in to comment.