savage-1.0.1: re-export of the random generators from Hedgehog

Safe HaskellNone
LanguageHaskell98

Savage

Synopsis

Documentation

type Gen = GenT Identity Source #

Generator for random values of a.

data GenT m a Source #

Monad transformer which can generate random values of a.

Instances

MMonad GenT Source # 

Methods

embed :: Monad n => (forall a. m a -> GenT n a) -> GenT m b -> GenT n b #

MonadTrans GenT Source # 

Methods

lift :: Monad m => m a -> GenT m a #

Distributive GenT Source # 

Associated Types

type Transformer (f :: (* -> *) -> * -> *) (GenT :: (* -> *) -> * -> *) (m :: * -> *) :: Constraint Source #

Methods

distribute :: Transformer f GenT m => GenT (f m) a -> f (GenT m) a Source #

MonadBase b m => MonadBase b (GenT m) Source # 

Methods

liftBase :: b α -> GenT m α #

MonadError e m => MonadError e (GenT m) Source # 

Methods

throwError :: e -> GenT m a #

catchError :: GenT m a -> (e -> GenT m a) -> GenT m a #

MonadReader r m => MonadReader r (GenT m) Source # 

Methods

ask :: GenT m r #

local :: (r -> r) -> GenT m a -> GenT m a #

reader :: (r -> a) -> GenT m a #

MonadState s m => MonadState s (GenT m) Source # 

Methods

get :: GenT m s #

put :: s -> GenT m () #

state :: (s -> (a, s)) -> GenT m a #

MonadWriter w m => MonadWriter w (GenT m) Source # 

Methods

writer :: (a, w) -> GenT m a #

tell :: w -> GenT m () #

listen :: GenT m a -> GenT m (a, w) #

pass :: GenT m (a, w -> w) -> GenT m a #

Monad m => Monad (GenT m) Source # 

Methods

(>>=) :: GenT m a -> (a -> GenT m b) -> GenT m b #

(>>) :: GenT m a -> GenT m b -> GenT m b #

return :: a -> GenT m a #

fail :: String -> GenT m a #

Functor m => Functor (GenT m) Source # 

Methods

fmap :: (a -> b) -> GenT m a -> GenT m b #

(<$) :: a -> GenT m b -> GenT m a #

Monad m => Applicative (GenT m) Source # 

Methods

pure :: a -> GenT m a #

(<*>) :: GenT m (a -> b) -> GenT m a -> GenT m b #

(*>) :: GenT m a -> GenT m b -> GenT m b #

(<*) :: GenT m a -> GenT m b -> GenT m a #

MonadIO m => MonadIO (GenT m) Source # 

Methods

liftIO :: IO a -> GenT m a #

Monad m => Alternative (GenT m) Source # 

Methods

empty :: GenT m a #

(<|>) :: GenT m a -> GenT m a -> GenT m a #

some :: GenT m a -> GenT m [a] #

many :: GenT m a -> GenT m [a] #

Monad m => MonadPlus (GenT m) Source # 

Methods

mzero :: GenT m a #

mplus :: GenT m a -> GenT m a -> GenT m a #

MonadCatch m => MonadCatch (GenT m) Source # 

Methods

catch :: Exception e => GenT m a -> (e -> GenT m a) -> GenT m a #

MonadThrow m => MonadThrow (GenT m) Source # 

Methods

throwM :: Exception e => e -> GenT m a #

PrimMonad m => PrimMonad (GenT m) Source # 

Associated Types

type PrimState (GenT m :: * -> *) :: * #

Methods

primitive :: (State# (PrimState (GenT m)) -> (#VoidRep, PtrRepLifted, State# (PrimState (GenT m)), a#)) -> GenT m a #

MonadResource m => MonadResource (GenT m) Source # 

Methods

liftResourceT :: ResourceT IO a -> GenT m a #

Monad m => MonadGen (GenT m) Source # 

Methods

liftGen :: Gen a -> GenT m a Source #

shrinkGen :: (a -> [a]) -> GenT m a -> GenT m a Source #

pruneGen :: GenT m a -> GenT m a Source #

scaleGen :: (Size -> Size) -> GenT m a -> GenT m a Source #

freezeGen :: GenT m a -> GenT m (a, GenT m a) Source #

MFunctor * GenT Source # 

Methods

hoist :: Monad m => (forall a. m a -> n a) -> t m b -> t n b #

type Transformer t GenT m Source # 
type PrimState (GenT m) Source # 
type PrimState (GenT m) = PrimState m

class Monad m => MonadGen m where Source #

Class of monads which can generate input data for tests.

The functions on this class can, and should, be used without their Gen suffix by importing Hedgehog.Gen qualified.

Minimal complete definition

liftGen, shrinkGen, pruneGen, scaleGen, freezeGen

Methods

liftGen :: Gen a -> m a Source #

See Gen.lift

shrinkGen :: (a -> [a]) -> m a -> m a Source #

See Gen.shrink

pruneGen :: m a -> m a Source #

See Gen.prune

scaleGen :: (Size -> Size) -> m a -> m a Source #

See Gen.scale

freezeGen :: m a -> m (a, m a) Source #

See Gen.freeze

Instances

MonadGen m => MonadGen (MaybeT m) Source # 

Methods

liftGen :: Gen a -> MaybeT m a Source #

shrinkGen :: (a -> [a]) -> MaybeT m a -> MaybeT m a Source #

pruneGen :: MaybeT m a -> MaybeT m a Source #

scaleGen :: (Size -> Size) -> MaybeT m a -> MaybeT m a Source #

freezeGen :: MaybeT m a -> MaybeT m (a, MaybeT m a) Source #

Monad m => MonadGen (GenT m) Source # 

Methods

liftGen :: Gen a -> GenT m a Source #

shrinkGen :: (a -> [a]) -> GenT m a -> GenT m a Source #

pruneGen :: GenT m a -> GenT m a Source #

scaleGen :: (Size -> Size) -> GenT m a -> GenT m a Source #

freezeGen :: GenT m a -> GenT m (a, GenT m a) Source #

(MonadGen m, Monoid w) => MonadGen (WriterT w m) Source # 

Methods

liftGen :: Gen a -> WriterT w m a Source #

shrinkGen :: (a -> [a]) -> WriterT w m a -> WriterT w m a Source #

pruneGen :: WriterT w m a -> WriterT w m a Source #

scaleGen :: (Size -> Size) -> WriterT w m a -> WriterT w m a Source #

freezeGen :: WriterT w m a -> WriterT w m (a, WriterT w m a) Source #

MonadGen m => MonadGen (StateT s m) Source # 

Methods

liftGen :: Gen a -> StateT s m a Source #

shrinkGen :: (a -> [a]) -> StateT s m a -> StateT s m a Source #

pruneGen :: StateT s m a -> StateT s m a Source #

scaleGen :: (Size -> Size) -> StateT s m a -> StateT s m a Source #

freezeGen :: StateT s m a -> StateT s m (a, StateT s m a) Source #

MonadGen m => MonadGen (ExceptT x m) Source # 

Methods

liftGen :: Gen a -> ExceptT x m a Source #

shrinkGen :: (a -> [a]) -> ExceptT x m a -> ExceptT x m a Source #

pruneGen :: ExceptT x m a -> ExceptT x m a Source #

scaleGen :: (Size -> Size) -> ExceptT x m a -> ExceptT x m a Source #

freezeGen :: ExceptT x m a -> ExceptT x m (a, ExceptT x m a) Source #

MonadGen m => MonadGen (IdentityT * m) Source # 

Methods

liftGen :: Gen a -> IdentityT * m a Source #

shrinkGen :: (a -> [a]) -> IdentityT * m a -> IdentityT * m a Source #

pruneGen :: IdentityT * m a -> IdentityT * m a Source #

scaleGen :: (Size -> Size) -> IdentityT * m a -> IdentityT * m a Source #

freezeGen :: IdentityT * m a -> IdentityT * m (a, IdentityT * m a) Source #

MonadGen m => MonadGen (StateT s m) Source # 

Methods

liftGen :: Gen a -> StateT s m a Source #

shrinkGen :: (a -> [a]) -> StateT s m a -> StateT s m a Source #

pruneGen :: StateT s m a -> StateT s m a Source #

scaleGen :: (Size -> Size) -> StateT s m a -> StateT s m a Source #

freezeGen :: StateT s m a -> StateT s m (a, StateT s m a) Source #

(MonadGen m, Monoid w) => MonadGen (WriterT w m) Source # 

Methods

liftGen :: Gen a -> WriterT w m a Source #

shrinkGen :: (a -> [a]) -> WriterT w m a -> WriterT w m a Source #

pruneGen :: WriterT w m a -> WriterT w m a Source #

scaleGen :: (Size -> Size) -> WriterT w m a -> WriterT w m a Source #

freezeGen :: WriterT w m a -> WriterT w m (a, WriterT w m a) Source #

MonadGen m => MonadGen (ReaderT * r m) Source # 

Methods

liftGen :: Gen a -> ReaderT * r m a Source #

shrinkGen :: (a -> [a]) -> ReaderT * r m a -> ReaderT * r m a Source #

pruneGen :: ReaderT * r m a -> ReaderT * r m a Source #

scaleGen :: (Size -> Size) -> ReaderT * r m a -> ReaderT * r m a Source #

freezeGen :: ReaderT * r m a -> ReaderT * r m (a, ReaderT * r m a) Source #

(MonadGen m, Monoid w) => MonadGen (RWST r w s m) Source # 

Methods

liftGen :: Gen a -> RWST r w s m a Source #

shrinkGen :: (a -> [a]) -> RWST r w s m a -> RWST r w s m a Source #

pruneGen :: RWST r w s m a -> RWST r w s m a Source #

scaleGen :: (Size -> Size) -> RWST r w s m a -> RWST r w s m a Source #

freezeGen :: RWST r w s m a -> RWST r w s m (a, RWST r w s m a) Source #

(MonadGen m, Monoid w) => MonadGen (RWST r w s m) Source # 

Methods

liftGen :: Gen a -> RWST r w s m a Source #

shrinkGen :: (a -> [a]) -> RWST r w s m a -> RWST r w s m a Source #

pruneGen :: RWST r w s m a -> RWST r w s m a Source #

scaleGen :: (Size -> Size) -> RWST r w s m a -> RWST r w s m a Source #

freezeGen :: RWST r w s m a -> RWST r w s m (a, RWST r w s m a) Source #

data Range a Source #

A range describes the bounds of a number to generate, which may or may not be dependent on a Size.

Instances

Functor Range Source # 

Methods

fmap :: (a -> b) -> Range a -> Range b #

(<$) :: a -> Range b -> Range a #

newtype Size Source #

Tests are parameterized by the size of the randomly-generated data, the meaning of which depends on the particular generator used.

Constructors

Size 

Fields

Instances

Enum Size Source # 

Methods

succ :: Size -> Size #

pred :: Size -> Size #

toEnum :: Int -> Size #

fromEnum :: Size -> Int #

enumFrom :: Size -> [Size] #

enumFromThen :: Size -> Size -> [Size] #

enumFromTo :: Size -> Size -> [Size] #

enumFromThenTo :: Size -> Size -> Size -> [Size] #

Eq Size Source # 

Methods

(==) :: Size -> Size -> Bool #

(/=) :: Size -> Size -> Bool #

Integral Size Source # 

Methods

quot :: Size -> Size -> Size #

rem :: Size -> Size -> Size #

div :: Size -> Size -> Size #

mod :: Size -> Size -> Size #

quotRem :: Size -> Size -> (Size, Size) #

divMod :: Size -> Size -> (Size, Size) #

toInteger :: Size -> Integer #

Num Size Source # 

Methods

(+) :: Size -> Size -> Size #

(-) :: Size -> Size -> Size #

(*) :: Size -> Size -> Size #

negate :: Size -> Size #

abs :: Size -> Size #

signum :: Size -> Size #

fromInteger :: Integer -> Size #

Ord Size Source # 

Methods

compare :: Size -> Size -> Ordering #

(<) :: Size -> Size -> Bool #

(<=) :: Size -> Size -> Bool #

(>) :: Size -> Size -> Bool #

(>=) :: Size -> Size -> Bool #

max :: Size -> Size -> Size #

min :: Size -> Size -> Size #

Read Size Source # 
Real Size Source # 

Methods

toRational :: Size -> Rational #

Show Size Source # 

Methods

showsPrec :: Int -> Size -> ShowS #

show :: Size -> String #

showList :: [Size] -> ShowS #

data Seed Source #

A splittable random number generator.

Constructors

Seed 

Fields

Instances

Eq Seed Source # 

Methods

(==) :: Seed -> Seed -> Bool #

(/=) :: Seed -> Seed -> Bool #

Ord Seed Source # 

Methods

compare :: Seed -> Seed -> Ordering #

(<) :: Seed -> Seed -> Bool #

(<=) :: Seed -> Seed -> Bool #

(>) :: Seed -> Seed -> Bool #

(>=) :: Seed -> Seed -> Bool #

max :: Seed -> Seed -> Seed #

min :: Seed -> Seed -> Seed #

Read Seed Source # 
Show Seed Source # 

Methods

showsPrec :: Int -> Seed -> ShowS #

show :: Seed -> String #

showList :: [Seed] -> ShowS #

RandomGen Seed Source # 

Methods

next :: Seed -> (Int, Seed) #

genRange :: Seed -> (Int, Int) #

split :: Seed -> (Seed, Seed) #

class Distributive g where Source #

Minimal complete definition

distribute

Associated Types

type Transformer (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *) (m :: * -> *) :: Constraint Source #

Methods

distribute :: Transformer f g m => g (f m) a -> f (g m) a Source #

Distribute one monad transformer over another.

Instances

Distributive MaybeT Source # 

Associated Types

type Transformer (f :: (* -> *) -> * -> *) (MaybeT :: (* -> *) -> * -> *) (m :: * -> *) :: Constraint Source #

Methods

distribute :: Transformer f MaybeT m => MaybeT (f m) a -> f (MaybeT m) a Source #

Distributive Tree Source # 

Associated Types

type Transformer (f :: (* -> *) -> * -> *) (Tree :: (* -> *) -> * -> *) (m :: * -> *) :: Constraint Source #

Methods

distribute :: Transformer f Tree m => Tree (f m) a -> f (Tree m) a Source #

Distributive GenT Source # 

Associated Types

type Transformer (f :: (* -> *) -> * -> *) (GenT :: (* -> *) -> * -> *) (m :: * -> *) :: Constraint Source #

Methods

distribute :: Transformer f GenT m => GenT (f m) a -> f (GenT m) a Source #

Monoid w => Distributive (WriterT w) Source # 

Associated Types

type Transformer (f :: (* -> *) -> * -> *) (WriterT w :: (* -> *) -> * -> *) (m :: * -> *) :: Constraint Source #

Methods

distribute :: Transformer f (WriterT w) m => WriterT w (f m) a -> f (WriterT w m) a Source #

Distributive (ExceptT x) Source # 

Associated Types

type Transformer (f :: (* -> *) -> * -> *) (ExceptT x :: (* -> *) -> * -> *) (m :: * -> *) :: Constraint Source #

Methods

distribute :: Transformer f (ExceptT x) m => ExceptT x (f m) a -> f (ExceptT x m) a Source #

Distributive (ReaderT * r) Source # 

Associated Types

type Transformer (f :: (* -> *) -> * -> *) (ReaderT * r :: (* -> *) -> * -> *) (m :: * -> *) :: Constraint Source #

Methods

distribute :: Transformer f (ReaderT * r) m => ReaderT * r (f m) a -> f (ReaderT * r m) a Source #