You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
652 B

package green.thisfieldwas.embracingnondeterminism.util
import org.scalacheck.Gen
/** A typeclass to aid in generating lifted instances of any other generated
* type.
*
* @tparam F
* The type to lift another generated type into.
*/
trait LiftedGen[F[_]] {
/** Given a generator, lift its output into `F`.
*
* @param gen
* The generator whose outputs to lift.
* @tparam A
* The type output by the generator.
* @return
* A generator containing the lifted output.
*/
def lift[A](gen: Gen[A]): Gen[F[A]]
}
object LiftedGen {
def apply[F[_]: LiftedGen]: LiftedGen[F] = implicitly[LiftedGen[F]]
}