Copyright | (c) Maciej Bendkowski 2017 |
---|---|
License | BSD3 |
Maintainer | maciej.bendkowski@tcs.uj.edu.pl |
Stability | experimental |
Safe Haskell | Safe |
Language | Haskell2010 |
Boltzmann samplers for plain and closed h-shallow lambda terms (closed lambda terms in which each de Bruijn index is bounded by h).
The exact outcome size of a Boltzmann sampler is a random variable. Its moments, in particular expectation, can be calibrated by adjusting the formal evaluation parameter (see Data.Lambda.Random.System or Data.Lambda.Random.PlainSystem). Boltzmann samplers guarantee that terms of equal size have equal probability of being chosen.
- closedShallowLambda :: (Random a, Num a, Ord a, Integral b, RandomGen g) => Sampler a b -> b -> b -> Rand g Lambda
- closedShallowLambdaIO :: (Random a, Num a, Ord a, Integral b) => Sampler a b -> b -> b -> IO Lambda
- filterClosedShallow :: (Random a, Num a, Ord a, Integral b, RandomGen g) => (Lambda -> Bool) -> Sampler a b -> b -> b -> Rand g Lambda
- filterClosedShallowIO :: (Random a, Num a, Ord a, Integral b) => (Lambda -> Bool) -> Sampler a b -> b -> b -> IO Lambda
- closedLambda :: (Random a, Num a, Ord a, Integral b, RandomGen g) => MixedSampler a b -> b -> b -> Rand g Lambda
- closedLambdaIO :: (Random a, Num a, Ord a, Integral b) => MixedSampler a b -> b -> b -> IO Lambda
- filterClosed :: (Random a, Num a, Ord a, Integral b, RandomGen g) => (Lambda -> Bool) -> MixedSampler a b -> b -> b -> Rand g Lambda
- filterClosedIO :: (Random a, Num a, Ord a, Integral b) => (Lambda -> Bool) -> MixedSampler a b -> b -> b -> IO Lambda
- plainLambda :: (Random a, Num a, Ord a, Integral b, RandomGen g) => PlainSampler a b -> b -> b -> Rand g Lambda
- plainLambdaIO :: (Random a, Num a, Ord a, Integral b) => PlainSampler a b -> b -> b -> IO Lambda
- filterPlain :: (Random a, Num a, Ord a, Integral b, RandomGen g) => (Lambda -> Bool) -> PlainSampler a b -> b -> b -> Rand g Lambda
- filterPlainIO :: (Random a, Num a, Ord a, Integral b) => (Lambda -> Bool) -> PlainSampler a b -> b -> b -> IO Lambda
Closed h-shallow lambda terms
:: (Random a, Num a, Ord a, Integral b, RandomGen g) | |
=> Sampler a b | Boltzmann sampler to use. |
-> b | Outcome size lower bound. |
-> b | Outcome size upper bound. |
-> Rand g Lambda | The monadic result. |
Samples a random closed h-shallow lambda term in the given size range.
closedShallowLambdaIO Source #
:: (Random a, Num a, Ord a, Integral b) | |
=> Sampler a b | Boltzmann sampler to use. |
-> b | Outcome size lower bound. |
-> b | Outcome size upper bound. |
-> IO Lambda | The monadic result. |
Samples a random closed h-shallow lambda term in the given size range
using the IO monad. See closedShallowLambda
for more details.
Filter samplers for closed h-shallow lambda terms
:: (Random a, Num a, Ord a, Integral b, RandomGen g) | |
=> (Lambda -> Bool) | Filter function to use. |
-> Sampler a b | Boltzmann sampler to use. |
-> b | Outcome size lower bound. |
-> b | Outcome size upper bound. |
-> Rand g Lambda | The monadic result. |
Samples a random closed h-shallow lambda term in the given
size range. In addition, the term has to satisfy the given predicate.
See also closedShallowLambda
.
filterClosedShallowIO Source #
:: (Random a, Num a, Ord a, Integral b) | |
=> (Lambda -> Bool) | Filter function to use. |
-> Sampler a b | Boltzmann sampler to use. |
-> b | Outcome size lower bound. |
-> b | Outcome size upper bound. |
-> IO Lambda | The monadic result. |
Samples a random closed h-shallow lambda term in the given
size range. In addition, the term has to satisfy the given predicate.
The IO monad is used as the source of random numbers.
See also filterClosedShallow
.
Closed lambda terms
:: (Random a, Num a, Ord a, Integral b, RandomGen g) | |
=> MixedSampler a b | Boltzmann sampler to use. |
-> b | Outcome size lower bound. |
-> b | Outcome size upper bound. |
-> Rand g Lambda | The monadic result. |
Samples a random closed lambda term in the given size range.
:: (Random a, Num a, Ord a, Integral b) | |
=> MixedSampler a b | Boltzmann sampler to use. |
-> b | Outcome size lower bound. |
-> b | Outcome size upper bound. |
-> IO Lambda | The monadic result. |
Samples a random closed lambda term in the given size range
using the IO monad. See closedLambda
for more details.
Filter samplers for plain lambda terms
:: (Random a, Num a, Ord a, Integral b, RandomGen g) | |
=> (Lambda -> Bool) | Filter function to use. |
-> MixedSampler a b | Boltzmann sampler to use. |
-> b | Outcome size lower bound. |
-> b | Outcome size upper bound. |
-> Rand g Lambda | The monadic result. |
Samples a random closed lambda term in the given size range
In addition, the term has to satisfy the given predicate.
See also closedLambda
.
:: (Random a, Num a, Ord a, Integral b) | |
=> (Lambda -> Bool) | Filter function to use. |
-> MixedSampler a b | Boltzmann sampler to use. |
-> b | Outcome size lower bound. |
-> b | Outcome size upper bound. |
-> IO Lambda | The monadic result. |
Samples a random closed lambda term in the given size range.
In addition, the term has to satisfy the given predicate.
The IO monad is used as the source of random numbers.
See also filterClosed
.
Plain lambda terms
:: (Random a, Num a, Ord a, Integral b, RandomGen g) | |
=> PlainSampler a b | Boltzmann sampler to use. |
-> b | Outcome size lower bound. |
-> b | Outcome size upper bound. |
-> Rand g Lambda | The monadic result. |
Samples a random plain lambda term in the given size range.
:: (Random a, Num a, Ord a, Integral b) | |
=> PlainSampler a b | Boltzmann sampler to use. |
-> b | Outcome size lower bound. |
-> b | Outcome size upper bound. |
-> IO Lambda | The monadic result. |
Samples a random plain lambda term in the given size range
using the IO monad. See plainLambda
for more details.
Filter samplers for plain lambda terms
:: (Random a, Num a, Ord a, Integral b, RandomGen g) | |
=> (Lambda -> Bool) | Filter function to use. |
-> PlainSampler a b | Boltzmann sampler to use. |
-> b | Outcome size lower bound. |
-> b | Outcome size upper bound. |
-> Rand g Lambda | The monadic result. |
Samples a random plain lambda term in the given
size range. In addition, the term has to satisfy the given predicate.
See also plainLambda
.
:: (Random a, Num a, Ord a, Integral b) | |
=> (Lambda -> Bool) | Filter function to use. |
-> PlainSampler a b | Boltzmann sampler to use. |
-> b | Outcome size lower bound. |
-> b | Outcome size upper bound. |
-> IO Lambda | The monadic result. |
Samples a random plain lambda term in the given
size range. In addition, the term has to satisfy the given predicate.
The IO monad is used as the source of random numbers.
See also filterPlain
.