Skip to content
Cats Instances For Scalacheck
Branch: master
Clone or download
Latest commit 244cf25 Jun 10, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
core/shared/src Add FunctorFilter instance Nov 21, 2018
docs/src/main/tut Add FunctorFilter instance Nov 21, 2018
project Update tut-plugin to 0.6.12 Jun 8, 2019
.gitignore
.scalafmt.conf Initial Commit May 10, 2018
.travis.yml Update Scala Version Mar 12, 2019
CODE_OF_CONDUCT.md Add Code of Conduct Aug 25, 2018
LICENSE Add License, Update Readme and Build May 10, 2018
README.md Code sample in the readme was fixed (mostly copied from the microsite) Jan 17, 2019
build.sbt
version.sbt Setting version to 0.1.2-SNAPSHOT Mar 13, 2019

README.md

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.Applicative
import cats.implicits._

val apComposition: Gen[(Int, String)] = Applicative[Gen].product(
  Arbitrary.arbitrary[Int],
  Arbitrary.arbitrary[String]
)

Instances

Gen

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

Cogen

  • ContravariantSemigroupal[Cogen]
  • MonoidK[Cogen]

Why in org.scalacheck

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

You can’t perform that action at this time.