stepwise-1.0.2

Control.Monad.Stepwise.Derived

Description

This module contains some utility functions that build on the core interface of Stepwise computations.

Todo: nicer abstractions for specific merge-patterns.

Synopsis

Documentation

localChoice :: (i w -> Stepwise e i o w a -> i w -> Stepwise e i o w a -> Stepwise e i o w a) -> (e -> e -> Stepwise e i o w a) -> Stepwise e i o w a -> Stepwise e i o w a -> Stepwise e i o w aSource

Chooses locally: i.e. does not allow a lookahead beyond the current computation. A subcomputation does not see beyond the current choice.

mergeSteps :: (Monoid (i w), Monoid e, Error e) => i w -> Stepwise e i o w a -> i w -> Stepwise e i o w a -> Stepwise e i o w aSource

Merges two steps into a single step, thereby making use of the monoid instance.

globalChoice :: Error e => (forall v. Stepwise e i Lazy v a) -> (forall v. Stepwise e i Lazy v a) -> Stepwise e i o w aSource

Global choice. Takes the computation with the shortest sequence of reports that succeeds, or the longest that fails. First parameter is a transcoder that translates reports to the final domain.