Skip to content

Add fj.test.Gen.sequence(Validation<E, Gen<A>>). #401

@drewctaylor

Description

@drewctaylor

It should transform a validation for a generator into a generator of validations: if the given validation is a failure, the generator produces that failure value; if the given validation is a success, the generator produces success values.

public static <E, A> Gen<Validation<E, A>> sequence(final Validation<E, Gen<A>> gv) {
    return gen(i -> r -> gv.map(g -> g.gen(i, r)));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions