question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support `Gen.pick` by analogy to `Seq.pick`

See original GitHub issue

Seq.pick is a very useful function that applies a given “chooser” function to successive elements, returning the first x where the function returns Some x. By analogy, I think FsCheck should provide a similar function. Here’s a simple implementation that demonstrates the idea:

let rec pick chooser gn =
    gen {
        let! value = gn
        match chooser value with
            | Some v -> return v
            | None -> return! pick chooser gn
    }

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ploehcommented, Nov 29, 2022

That’s what I get for asking 😅 That’s not really in my wheelhouse, but in any case it’s hard to suggest alternatives without code.

0reactions
brianbernscommented, Nov 29, 2022

Sure. I’m working on a compiler that does type inferencing, which relies on a unification algorithm. Two types can be unified if there is a substitution that can be applied to both types to make them equal. My unit test generates pairs of types that can be unified and then verifies that the substitution does indeed produce equal types. I don’t know how to do this constructively (i.e. without filtering), but I’m certainly open to suggestions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sequences - F# | Microsoft Learn
A sequence is a logical series of elements all of one type. Sequences are particularly useful when you have a large, ordered collection...
Read more >
A Beginner's Guide to Analysis of RNA Sequencing Data - NCBI
A major goal of RNA-seq analysis is to identify differentially expressed and coregulated genes and to infer biological meaning for further ...
Read more >
A survey of best practices for RNA-seq data analysis
This is achieved by first defining a good experimental design, that is, by choosing the library type, sequencing depth and number of replicates ......
Read more >
RefSeq Frequently Asked Questions (FAQ)
These RefSeq records are derived from the genome sequence and have varying levels of transcript or protein homology support.
Read more >
Recommendations for Choosing the Genotyping Method ...
Recommendations for Choosing the Genotyping Method and Best Practices for Quality Control in Crop Genome-Wide Association Studies.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found