- data Effects f a
- perms :: forall f a. Alternative f => Effects f a -> f a
- once :: f a -> Effects f a
- opt :: f a -> Effects f (Maybe a)
- atLeast :: Int -> f a -> Effects f [a]
- between :: Int -> Int -> f a -> Effects f [a]
- exactly :: Int -> f a -> Effects f [a]
- many :: f a -> Effects f [a]
- some :: f a -> Effects f [a]
Documentation
A chain of effectful f
-computations with final result a
. Individual
computations (lifted into Effects
using one of the frequency combinators
below) have their own result types, which fit together in standard
Applicative
fashion. Although these result types are existentially
quantified, the computations can still be moved around within the list (see
swap
and firsts
in the source code for examples). This allows their
permutations to be computed.
perms :: forall f a. Alternative f => Effects f a -> f aSource
Build a tree (using <|>
for branching) of all permutations of the
computations. The tree shape allows permutations to share common prefixes.
This allows clever computations to quickly prune away uninteresting
branches of permutations.
Lifting computations
opt :: f a -> Effects f (Maybe a)Source
Run the computation exactly zero or one times in each permutation.
atLeast :: Int -> f a -> Effects f [a]Source
Run the computation at least so many times in each permutation.
between :: Int -> Int -> f a -> Effects f [a]Source
Run the computation between so and so many times (inclusive) in each permutation.