Control.Monad.Gen
- Package
- purescript-gen
- Repository
- purescript/purescript-gen
#frequency Source
frequency :: forall a f m. MonadGen m => Foldable1 f => f (Tuple Number (m a)) -> m aCreates a generator that outputs a value chosen from a selection of existing generators, where the selection has weight values for the probability of choice for each generator. The probability values will be normalised.
#unfoldable Source
unfoldable :: forall a f m. MonadRec m => MonadGen m => Unfoldable f => m a -> m (f a)Creates a generator that produces unfoldable structures based on an existing generator for the elements.
The size of the unfoldable will be determined by the current size state
for the generator. To generate an unfoldable structure of a particular
size, use the resize function from the MonadGen class first.
Re-exports from Control.Monad.Gen.Class
#MonadGen Source
class (Monad m) <= MonadGen m whereA class for random generator implementations.
Instances should provide implementations for the generation functions that return choices with uniform probability.
Members
chooseInt :: Int -> Int -> m IntchooseFloat :: Number -> Number -> m NumberChooses an floating point number in the specified (inclusive) range.
chooseBool :: m BooleanChooses a random boolean value.
resize :: forall a. (Size -> Size) -> m a -> m aModifies the size state for a random generator.
sized :: forall a. (Size -> m a) -> m aRuns a generator, passing in the current size state.
Chooses an integer in the specified (inclusive) range.