Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype PadsGen st a = PadsGen {}
- askGen :: MonadState (GenIO, st) (PadsGen st) => (GenIO -> PadsGen st a) -> PadsGen st a
- runPadsGenSt :: st -> PadsGen st a -> IO a
- getState :: PadsGen st st
- putState :: st -> PadsGen st ()
- runPadsGen :: PadsGen () a -> IO a
- randNum :: Variate a => PadsGen st a
- randNumBetween :: (Integral a, Variate a) => a -> a -> PadsGen st a
- randNumBound :: (Integral a, Variate a) => a -> PadsGen st a
- randInteger :: PadsGen st Integer
- randIntegerBound :: Integral a => a -> PadsGen st Integer
- randElem :: [a] -> PadsGen st a
- randLetter :: PadsGen st Char
- randLetterExcluding :: Char -> PadsGen st Char
- letters :: [Char]
- listLengthLimit :: Int
- randList :: PadsGen st a -> Maybe Int -> PadsGen st [a]
- recLimit :: Integer
- untilM :: Monad m => (a -> Bool) -> (a -> m a) -> Integer -> a -> m a
- randWithConstraint :: PadsGen st a -> (a -> Bool) -> PadsGen st a
Documentation
A custom application of the ReaderT monad, allowing threaded access to a random generator, supplied when the generation function is called at top level (i.e. via runPadsGen)
runPadsGenSt :: st -> PadsGen st a -> IO a Source #
Provides the requisite random number generator to the supplied generation computation and returns the result as a value in IO. Initial generator state must be given.
getState :: PadsGen st st Source #
Pull user-level state out of the generator (ignore the random seed).
putState :: st -> PadsGen st () Source #
Put user-level state intothe generator (carrying over the random seed).
runPadsGen :: PadsGen () a -> IO a Source #
Delegates to 'runPadsGen\''
randNum :: Variate a => PadsGen st a Source #
The types 'randNum'/'randNumBound'/'randNumBetween' return are dictated by the types of their callers.
randNumBetween :: (Integral a, Variate a) => a -> a -> PadsGen st a Source #
A number with bounds i and j
randInteger :: PadsGen st Integer Source #
As they aren't members of the System.Random.MWC class Variate, Integers require special treatment - convert them from doubles.
randLetter :: PadsGen st Char Source #
A random letter from English upper and lowercase letters
randLetterExcluding :: Char -> PadsGen st Char Source #
A random letter from English upper and lowercase letters, excluding the provided character
randList :: PadsGen st a -> Maybe Int -> PadsGen st [a] Source #
A list of random length, provided a PadsGen generator. Optionally also paramaterized by an Int, which if provided will be the length of the list