arbitrary

io.github.martinhh.derived.arbitrary
object arbitrary

Public "API-entry-point" for derivation of Arbitrary-instances.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
arbitrary.type

Members list

Value members

Inherited methods

inline def deriveArbitrary[T](using m: Of[T]): Arbitrary[T]

Derives an Arbitrary[T], ignoring any given Arbitrary[T] that is already in scope.

Derives an Arbitrary[T], ignoring any given Arbitrary[T] that is already in scope.

This can be used to explicitly create given instances:

 case class Point(x: Double, y: Double)
 given Arbitrary[Point] = deriveArbitrary

Attributes

Inherited from:
ArbitraryDeriving (hidden)

Givens

Inherited givens

inline given anyGivenArbitrary[T]: Arbitrary[T]

Resolves an Arbitrary[T], using existing given instances or falling back to derivation.

Resolves an Arbitrary[T], using existing given instances or falling back to derivation.

Existing given instances (that are in scope) will be preferred over derivation.

Importing this will add derivation as fallback to implicit resolution of Arbitrary- instances.

Note that the following will not work and result in an "Infinite loop in function body":

 case class Point(x: Double, y: Double)
 given Arbitrary[Point] = anyGivenArbitrary

If you intend to derive Arbitrary-instances in that way, use deriveArbitrary instead.

Attributes

Inherited from:
ArbitraryDeriving (hidden)