Safe Haskell | None |
---|---|
Language | Haskell2010 |
Provides primitives for high-level cryptographic sampling.
Synopsis
- type Distribution = DistributionT Identity
- newtype DistributionT m b = DistributionT {}
- class Sampler s where
- liftDistribution :: Monad m => Distribution b -> DistributionT m b
- coin :: Distribution Bool
- uniform :: [a] -> Distribution a
Documentation
type Distribution = DistributionT Identity Source #
Allows randomly sampling elements of type b
.
newtype DistributionT m b Source #
Allows randomly sampling elements of type b
in the context of monad m
.
Instances
class Sampler s where Source #
Provides randomness.
sampleCoin :: s -> (Bool, s) Source #
Produce a bit of randomness.
sample :: s -> DistributionT m b -> m (b, s) Source #
Samples a distribution.
sample' :: Monad m => s -> DistributionT m b -> m b Source #
Samples a distribution, discarding the result randomness.
liftDistribution :: Monad m => Distribution b -> DistributionT m b Source #
Lifts a Distribution
to an arbitrary monadic DistributionT
.
coin :: Distribution Bool Source #
Tosses a fair coin.
uniform :: [a] -> Distribution a Source #
A uniform Distribution
over all elements of [a]
.