Errors For Scala Core Scalacheck Instances


The Scaladoc for errors4s-core may be viewed here.


This project provides Scalacheck instances (Arbitrary and Cogen) for Errors4s Core types.

Add To Your Build

Add this to your libraryDependencies in your build.sbt.

    "org.errors4s" %% "errors4s-core-scalacheck" % "0.1.2"


The instances provided here are orphan instances. To use them you need to import the org.errors4s.core.scalacheck.instances._ package. You will also need to have an underlying implicit Arbitrary or Cogen in scope.

import org.errors4s.core._
import org.errors4s.core.scalacheck.instances._
import org.scalacheck._

val arb: Arbitrary[NonEmptyString] = implicitly[Arbitrary[NonEmptyString]]

val gen: Gen[NonEmptyString] = Arbitrary.arbitrary[NonEmptyString]

If for some reason you want to customize the underlying Arbitrary instance, you can do like this.

import org.errors4s.core._
import org.errors4s.core.scalacheck.instances._
import org.scalacheck.{Arbitrary, Gen}

implicit val arbString: Arbitrary[String] = Arbitrary(Gen.const("custom non-empty string"))
// res1: Option[NonEmptyString] = Some("custom non-empty string")

// Or more explicitly

// res2: Option[NonEmptyString] = Some("custom non-empty string")

Version Matrix

This project uses Package Versioning Policy (PVP). This is to allow long term support (see this discussion). This table lists the currently supported, upcoming, and recently end of life versions.

If you need support for a version combination which is not listed here, please open an issue and we will endeavor to add support for it if possible.

Version Errors4s Core Scalacheck Version Scala 2.11 Scala 2.12 Scala 2.13 Scala 3.0
1.0.x.x 1.0.x.x 1.15.4 No Yes Yes Yes