Skip to main content

Hedgehog Extra

Build Status Release Status GitHub Release Date

Maven Central Version Latest version

Hits codecov

Hedgehog Extra Logo

Newtypes and Refinement types for Scala 3

ProjectMaven CentralScala.jsScala Native
hedgehog-extra-coreMaven Central Version
hedgehog-extra-refinedMaven Central Version
hedgehog-extra-refined4sMaven Central Version
info

Scala.js cats-core Scala version support

Hedgehog Extra also supports Scala.js and Scala Native.

Getting Started

To get hedgehog-extra for your project,

hedgehog-extra-core

In build.sbt,

"io.kevinlee" %% "hedgehog-extra-core" % "0.21.0"

or for Scala.js and Scala Native

"io.kevinlee" %%% "hedgehog-extra-core" % "0.21.0"

hedgehog-extra-refined4s

For Scala 3, you have the option to use refined4s in place of newtype and refined, along with the support for refined4s provided by hedgehog-extra.

In build.sbt,

"io.kevinlee" %% "hedgehog-extra-refined4s" % "0.21.0"

or for Scala.js and Scala Native

"io.kevinlee" %%% "hedgehog-extra-refined4s" % "0.21.0"

hedgehog-extra-refined

In build.sbt,

"io.kevinlee" %% "hedgehog-extra-refined" % "0.21.0"

or for Scala.js

"io.kevinlee" %%% "hedgehog-extra-refined" % "0.21.0"

All hedgehog-extra modules

In build.sbt,

"io.kevinlee" %% "hedgehog-extra-core" % "0.21.0",
"io.kevinlee" %% "hedgehog-extra-refined" % "0.21.0",
"io.kevinlee" %% "hedgehog-extra-refined4s" % "0.21.0",

or for Scala.js

"io.kevinlee" %%% "hedgehog-extra-core" % "0.21.0",
"io.kevinlee" %%% "hedgehog-extra-refined" % "0.21.0",
"io.kevinlee" %%% "hedgehog-extra-refined4s" % "0.21.0",

or for Scala Native

"io.kevinlee" %%% "hedgehog-extra-core" % "0.21.0",
"io.kevinlee" %%% "hedgehog-extra-refined4s" % "0.21.0",

Documentation

Quick Start (Functional Composition)

import hedgehog.*
import hedgehog.extra.Gens
import hedgehog.extra.NumGens

val userCodeGen: Gen[String] =
for {
(min, max) <- NumGens.genIntMinMaxPair(4, 12)
suffix <- Gens.genUnsafeNonWhitespaceStringMinMax(min, max)
} yield s"user-$suffix"
// userCodeGen: GenT[String] = GenT(
// run = hedgehog.core.GenT$$Lambda$11272/0x00007f0539e262d8@3c0b852c
// )