cardano-wallet-core-2022.7.1: The Wallet Backend for a Cardano node.
Copyright © 2021 IOHK
License Apache-2.0
Safe Haskell None
Language Haskell2010

Control.Monad.Random.Extra

Description

This module provides functions and types that extend those provided by the Random module hierarchy.

Synopsis

Random number generator seeds

newtype StdGenSeed Source #

A seed for the standard random number generator.

This type is equivalent to the internal state of a StdGen , but provides a representation that is more convenient for construction and serialization.

The number of possible seeds is identical to the number of valid states of the StdGen type, but unlike the StdGen type, whose state has an internal invariant that must not be broken, values of the StdGenSeed type are correct by construction.

Constructors

StdGenSeed

Fields

Instances

Instances details
Bounded StdGenSeed Source #
Instance details

Defined in Control.Monad.Random.Extra

Eq StdGenSeed Source #
Instance details

Defined in Control.Monad.Random.Extra

Ord StdGenSeed Source #
Instance details

Defined in Control.Monad.Random.Extra

Show StdGenSeed Source #
Instance details

Defined in Control.Monad.Random.Extra

Generic StdGenSeed Source #
Instance details

Defined in Control.Monad.Random.Extra

ToJSON StdGenSeed Source #
Instance details

Defined in Control.Monad.Random.Extra

FromJSON StdGenSeed Source #
Instance details

Defined in Control.Monad.Random.Extra

type Rep StdGenSeed Source #
Instance details

Defined in Control.Monad.Random.Extra

stdGenSeed :: MonadRandom m => m StdGenSeed Source #

Creates a new StdGenSeed from within a random monadic context.

stdGenFromSeed :: StdGenSeed -> StdGen Source #

Converts a StdGenSeed value to a StdGen value.

This function satisfies the following properties:

>>> stdGenFromSeed . stdGenToSeed == id
>>> stdGenToSeed . stdGenFromSeed == id

stdGenToSeed :: StdGen -> StdGenSeed Source #

Converts a StdGen value to a StdGenSeed value.

This function satisfies the following properties:

>>> stdGenFromSeed . stdGenToSeed == id
>>> stdGenToSeed . stdGenFromSeed == id

Non-random contexts

newtype NonRandom a Source #

Provides a stateless context for computations that must be non-random.

This type is useful for testing functions that require a MonadRandom context, but when actual randomness is not required or even desired.

Constructors

NonRandom

Fields

Instances

Instances details
Monad NonRandom Source #
Instance details

Defined in Control.Monad.Random.Extra

Functor NonRandom Source #
Instance details

Defined in Control.Monad.Random.Extra

Applicative NonRandom Source #
Instance details

Defined in Control.Monad.Random.Extra

MonadRandom NonRandom Source #
Instance details

Defined in Control.Monad.Random.Extra

Eq a => Eq ( NonRandom a) Source #
Instance details

Defined in Control.Monad.Random.Extra

Ord a => Ord ( NonRandom a) Source #
Instance details

Defined in Control.Monad.Random.Extra

Show a => Show ( NonRandom a) Source #
Instance details

Defined in Control.Monad.Random.Extra

Generic ( NonRandom a) Source #
Instance details

Defined in Control.Monad.Random.Extra

Associated Types

type Rep ( NonRandom a) :: Type -> Type Source #

type Rep ( NonRandom a) Source #
Instance details

Defined in Control.Monad.Random.Extra

type Rep ( NonRandom a) = D1 (' MetaData "NonRandom" "Control.Monad.Random.Extra" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' True ) ( C1 (' MetaCons "NonRandom" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "runNonRandom") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 a)))