SeededGen

object SeededGen
Companion:
class
class Object
trait Matchable
class Any

Type members

Classlikes

abstract class Companion[S](extractor: SeedExtractor[S])

Extend this class in the companion object of a type or type tag that you would like to use as a seed.

Extend this class in the companion object of a type or type tag that you would like to use as a seed.

final case class UserId(value: String)
object UserId extends SeededGen.Companion[UserId](SeedExtractor.from(_.value)) {
 sealed abstract class Tag extends SeededGen.Tag
}

This will give you a uniform syntax for constructing seeded generators.

   val example: UserId.Gen[String] = UserId.gen(implicit userId => Gen.string)
final class FinalBuilder[S, T <: Tag]
final class SeededBuilder[S]
trait Tag

Extend this marker trait with either your seed class or another marker type tag.

Extend this marker trait with either your seed class or another marker type tag.

This is required to avoid defining an implicit conversion on any primitive types (in the case where you decide to use a primitive type seed). See toGen.

See also:

Companion documentation for an example of how to use this.

abstract class TagCompanion[S, T <: Tag](implicit extractor: SeedExtractor[S]) extends Companion[S]

Similar to Companion, but used when you don't want to define the Companion#Tag on the companion object of the model that you are using as a seed.

Similar to Companion, but used when you don't want to define the Companion#Tag on the companion object of the model that you are using as a seed.

Instead you can define a separate tag class and use this as the companion object for that tag type.

 final case class UserId(value: String)

 // in some other part of the code
 sealed abstract class UserIdSeeded extends SeededGen.Tag
 object UserIdSeeded extends SeededGen.TagCompanion[UserId, UserIdSeeded]

This will give you a uniform syntax for constructing seeded generators.

   val example: UserIdSeeded.Gen[String] = UserIdSeeded.gen(implicit userId => Gen.string)
final class TaggedBuilder[T <: Tag]

Types

type GenFn[-S, T <: Tag, V] = S @@ T => Gen[V]

Value members

Concrete methods

Begin building a SeededGen by providing the type of seed.

Begin building a SeededGen by providing the type of seed.

Begin building a SeededGen by providing the Tag type.

Begin building a SeededGen by providing the Tag type.

Implicits

Implicits

implicit def toGen[S, T <: Tag, V](seededGen: SeededGen[S, T, V])(implicit seed: S @@ T): Gen[V]

Implicitly converts a SeededGen into a regular Gen if there is the appropriate implicit seed in scope.

Implicitly converts a SeededGen into a regular Gen if there is the appropriate implicit seed in scope.

This implicit conversion makes it possible to flatMap over SeededGens the same way you do regular Gens, but it introduces the need to tag the seed type to avoid an implicit conversion on primitive types.