Safe Haskell | None |
---|---|

Language | Haskell2010 |

- data Urn a
- type Weight = Word
- class Monad m => MonadSample m
- size :: Urn a -> Word
- totalWeight :: Urn a -> Weight
- singleton :: Weight -> a -> Urn a
- fromList :: [(Weight, a)] -> Maybe (Urn a)
- fromNonEmpty :: NonEmpty (Weight, a) -> Urn a
- insert :: Weight -> a -> Urn a -> Urn a
- addToUrn :: Foldable t => Urn a -> t (Weight, a) -> Urn a

# 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 # | |

`Urn`

properties

totalWeight :: Urn a -> Weight Source #