Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Urn a
- data Index
- type Weight = Word
- class Monad m => MonadSample m
- singleton :: Weight -> a -> Urn a
- fromList :: [(Weight, a)] -> Maybe (Urn a)
- fromNonEmpty :: NonEmpty (Weight, a) -> Urn a
- randomIndex :: MonadSample m => Urn a -> m Index
- sample :: Urn a -> Index -> a
- remove :: Urn a -> Index -> (Weight, a, Maybe (Urn a))
- insert :: Weight -> a -> Urn a -> Urn a
- update :: (Weight -> a -> (Weight, a)) -> Urn a -> Index -> (Weight, a, Weight, a, Urn a)
- replace :: Weight -> a -> Urn a -> Index -> (Weight, a, Urn a)
- addToUrn :: Foldable t => Urn a -> t (Weight, a) -> Urn a
- size :: Urn a -> Word
- totalWeight :: Urn a -> Weight
Types
class Monad m => MonadSample m Source #
MonadSample IO Source # | |
MonadSample Gen Source # | |
MonadSample m => MonadSample (MaybeT m) Source # | |
(Monad m, RandomGen g) => MonadSample (RandT g m) Source # | |
MonadSample m => MonadSample (ExceptT e m) Source # | |
MonadSample m => MonadSample (StateT s m) Source # | |
MonadSample m => MonadSample (StateT s m) Source # | |
(MonadSample m, Monoid w) => MonadSample (WriterT w m) Source # | |
(MonadSample m, Monoid w) => MonadSample (WriterT w m) Source # | |
MonadSample m => MonadSample (IdentityT * m) Source # | |
MonadSample m => MonadSample (ContT * r m) Source # | |
MonadSample m => MonadSample (ReaderT * r m) Source # | |
(MonadSample m, Monoid w) => MonadSample (RWST r w s m) Source # | |
(MonadSample m, Monoid w) => MonadSample (RWST r w s m) Source # | |
Constructing Urn
s
Constructing indices
randomIndex :: MonadSample m => Urn a -> m Index Source #
Sampling
Updating
Other functions
Urn
properties
totalWeight :: Urn a -> Weight Source #