Skip to content

Commit

Permalink
Merge pull request #756 from nigredo-tori/589-cogen-domainof-redux
Browse files Browse the repository at this point in the history
Add Cogen.domainOf (again)
  • Loading branch information
larsrh authored Feb 11, 2021
2 parents cade049 + 17d2e64 commit 87c69f0
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 87c69f0

Please sign in to comment.