PermuteEffects-0.2: Permutations of effectful computations

Control.Permute

Synopsis

Documentation

data Effects f a Source

A chain of effectful f-computations with composite result a. Individual computations (lifted into Effects using *. below) have their own result types, which fit together in standard Applicative fashion. Although these result types are lost in the composite type, 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.

Instances

Functor (Effects f)

Map over the final result type.

Applicative (Effects f)

pure represents the empty list of computations while <*> acts like ++.

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.

(*.) :: Replicate a b -> f a -> Effects f bSource

Allow a computation to be occur so many times in each permutation.