class MonadGen :: (Type -> Type) -> Constraintclass (Monad m) <= MonadGen m  where

A class for random generator implementations.

Instances should provide implementations for the generation functions that return choices with uniform probability.

See also Gen in purescript-quickcheck, which implements this type class.


  • chooseInt :: Int -> Int -> m Int

    Chooses an integer in the specified (inclusive) range.

  • chooseFloat :: Number -> Number -> m Number

    Chooses an floating point number in the specified (inclusive) range.

  • chooseBool :: m Boolean

    Chooses a random boolean value.

  • resize :: forall a. (Size -> Size) -> m a -> m a

    Modifies the size state for a random generator.

  • sized :: forall a. (Size -> m a) -> m a

    Runs a generator, passing in the current size state.


type Size = Int