cats-scalacheck Build Status Maven Central

Inspiration Was Taken From the never published cats-check. Instances for Cats for scalacheck types. So all credit to erik-stripe and the last maintainer mdedetrich for their original work on this that helped me build this.

Quick Start

To use cats-scalacheck in an existing SBT project with Scala 2.11 or a later version, add the following dependency to your build.sbt:

libraryDependencies += "io.chrisdavenport" %% "cats-scalacheck" % "<version>"

Getting Started

import org.scalacheck._
import org.scalacheck.cats.implicits._
import cats.implicits._

val apComposition: Gen[(Int, String)] = Arbitrary.arbitrary[Int] <*> Arbitrary.arbitrary[String]

Instances

Gen

  • Alternative[Gen]
  • Monad[Gen]
  • Monoid[A] => Monoid[Gen[A]]
  • Semigroup[A] => Semigroup[Gen[A]]

Cogen

  • ContravariantSemigroupal[Gen]
  • MonoidK[Gen]

Why in org.scalacheck

This was necessary because scalacheck makes some of their instances package private that are required to roll these meaningfully.