nick8325 / quickcheck

Automatic testing of Haskell programs.
Other
713 stars 119 forks source link

Add StatefulGen instance for Gen #333

Open lehins opened 3 years ago

lehins commented 3 years ago

This is a preliminary PR to see if this functionality is even desired. In case that maintainers will see this as useful addition I can add some haddock and examples. Also QC was just the very first thing that came to mind, it can be renamed to something totally different.

This small change allows to use all of the stateful interface from new version of >= random-1.2.0 directly from within the Gen monad. For example:

Of course, instead of exporting QC we could just create specialized functions, i.e. uniform :: Uniform a => Gen a etc. but that is less useful IMHO, because it would prevent usage of other general functions that people could write for StatefulGen g m

MaximilianAlgehed commented 5 months ago

What's the rationale for having StatefulGen QC Gen and not StatefulGen QCGen Gen?

MaximilianAlgehed commented 5 months ago

What's the rationale for having StatefulGen QC Gen and not StatefulGen QCGen Gen?

Never mind, looking closer at the StatefulGen interface I get it now.