boltzmann-samplers-0.1.0.0: Uniform random generators

Safe HaskellNone
LanguageHaskell2010

Boltzmann.Data.Types

Contents

Description

Internal module

Synopsis

Documentation

data SomeData m where Source #

Constructors

SomeData :: Data a => m a -> SomeData m 

Instances

Show (SomeData m) Source #

Dummy instance for debugging.

Methods

showsPrec :: Int -> SomeData m -> ShowS #

show :: SomeData m -> String #

showList :: [SomeData m] -> ShowS #

data Alias m where Source #

Constructors

Alias :: (Data a, Data b) => !(m a -> m b) -> Alias m 

Instances

Show (Alias m) Source #

Dummy instance for debugging.

Methods

showsPrec :: Int -> Alias m -> ShowS #

show :: Alias m -> String #

showList :: [Alias m] -> ShowS #

type AliasR m = Alias (RejectT m) Source #

alias :: (Monad m, Data a, Data b) => (a -> m b) -> Alias m Source #

Main constructor for Alias.

aliasR :: (Monad m, Data a, Data b) => (a -> m b) -> AliasR m Source #

Main constructor for AliasR.

coerceAlias :: Coercible m n => Alias m -> Alias n Source #

coerceAlias :: Alias m -> Alias (AMonadRandom m)

coerceAliases :: Coercible m n => [Alias m] -> [Alias n] Source #

coerceAliases :: [Alias m] -> [Alias (AMonadRandom m)]

composeCastM :: forall a b c d m. (Typeable b, Typeable c) => (m c -> d) -> (a -> m b) -> a -> d Source #

composeCast f g = f . g

castM :: forall a b m. (Typeable a, Typeable b) => m a -> m b Source #

applyCast :: (Typeable a, Data b) => (m a -> m b) -> SomeData m -> SomeData m Source #

castError :: (Typeable a, Typeable b) => proxy a -> proxy' b -> c Source #

withProxy :: (a -> b) -> proxy a -> b Source #

reproxy :: proxy a -> Proxy a Source #

proxyType :: m a -> proxy a -> m a Source #

someData' :: Data a => proxy a -> SomeData' Source #

type Size = Int Source #

Size as the number of constructors.

newtype RejectT m a Source #

Internal transformer for rejection sampling.

ReaderT Size (StateT Size (MaybeT m)) a

Constructors

RejectT 

Fields

Instances

MonadTrans RejectT Source # 

Methods

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

Monad (RejectT m) Source # 

Methods

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

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

return :: a -> RejectT m a #

fail :: String -> RejectT m a #

Functor (RejectT m) Source # 

Methods

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

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

Applicative (RejectT m) Source # 

Methods

pure :: a -> RejectT m a #

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

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

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

MonadRandomLike m => MonadRandomLike (RejectT m) Source # 

runRejectT :: Monad m => (Size, Size) -> RejectT m a -> m a Source #

Set lower bound

Dictionaries

class Monad m => MonadRandomLike m where Source #

MonadRandomLike m defines basic components to build generators, allowing the implementation to remain abstract over both the Gen type and MonadRandom instances.

For the latter, the wrapper AMonadRandom is provided to avoid overlapping instances.

Minimal complete definition

doubleR, integerR, int, double, char

Methods

incr :: m () Source #

Called for every constructor. Counter for ceiled rejection sampling.

doubleR :: Double -> m Double Source #

doubleR upperBound: generates values in [0, upperBound].

integerR :: Integer -> m Integer Source #

integerR upperBound: generates values in [0, upperBound-1].

int :: m Int Source #

Default Int generator.

double :: m Double Source #

Default Double generator.

char :: m Char Source #

Default Char generator.