urn-random-0.1.0.0: A package for updatable discrete distributions

Safe HaskellNone
LanguageHaskell2010

Data.Urn.Common

Contents

Synopsis

Types

data Urn a Source #

Instances

Show a => Show (Urn a) Source #

This Show instance prints out the elements from most-weighted to least-weighted; however, do not rely on the order of equally-weighted elements, as this may depend on details of the implementation.

Methods

showsPrec :: Int -> Urn a -> ShowS #

show :: Urn a -> String #

showList :: [Urn a] -> ShowS #

NFData a => NFData (Urn a) Source # 

Methods

rnf :: Urn a -> () #

class Monad m => MonadSample m Source #

Instances

MonadSample IO Source # 

Methods

randomWord :: (Word, Word) -> IO Word Source #

MonadSample Gen Source # 

Methods

randomWord :: (Word, Word) -> Gen Word Source #

MonadSample m => MonadSample (MaybeT m) Source # 

Methods

randomWord :: (Word, Word) -> MaybeT m Word Source #

(Monad m, RandomGen g) => MonadSample (RandT g m) Source # 

Methods

randomWord :: (Word, Word) -> RandT g m Word Source #

MonadSample m => MonadSample (ExceptT e m) Source # 

Methods

randomWord :: (Word, Word) -> ExceptT e m Word Source #

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

Methods

randomWord :: (Word, Word) -> StateT s m Word Source #

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

Methods

randomWord :: (Word, Word) -> StateT s m Word Source #

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

Methods

randomWord :: (Word, Word) -> WriterT w m Word Source #

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

Methods

randomWord :: (Word, Word) -> WriterT w m Word Source #

MonadSample m => MonadSample (IdentityT * m) Source # 
MonadSample m => MonadSample (ContT * r m) Source # 

Methods

randomWord :: (Word, Word) -> ContT * r m Word Source #

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

Methods

randomWord :: (Word, Word) -> ReaderT * r m Word Source #

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

Methods

randomWord :: (Word, Word) -> RWST r w s m Word Source #

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

Methods

randomWord :: (Word, Word) -> RWST r w s m Word Source #

Urn properties

size :: Urn a -> Word Source #

Constructing Urns

singleton :: Weight -> a -> Urn a Source #

fromList :: [(Weight, a)] -> Maybe (Urn a) Source #

Inserting into Urns

insert :: Weight -> a -> Urn a -> Urn a Source #

addToUrn :: Foldable t => Urn a -> t (Weight, a) -> Urn a Source #