Control.Permute
Documentation
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.
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.