Strafunski-StrategyLib-5.0.0.3: Library for strategic programming

Portabilityportable
Stabilityexperimental
MaintainerRalf Laemmel, Joost Visser
Safe HaskellNone

Data.Generics.Strafunski.StrategyLib.TraversalTheme

Contents

Description

This module is part of StrategyLib, a library of functional strategy combinators, including combinators for generic traversal. This module defines traversal schemes. Such schemes have formed the core of StrategyLib since its first release. The portfolio as it stands now captures part of the design in the paper ... Polymorphic Symphony.

Synopsis

Recursive traversal

Full traversals

full_tdTP :: Monad m => TP m -> TP mSource

Full type-preserving traversal in top-down order.

full_buTP :: Monad m => TP m -> TP mSource

Full type-preserving traversal in bottom-up order.

full_tdTU :: (Monad m, Monoid a) => TU a m -> TU a mSource

Full type-unifying traversal in top-down order.

Traversals with stop conditions

stop_tdTP :: MonadPlus m => TP m -> TP mSource

Top-down type-preserving traversal that is cut of below nodes where the argument strategy succeeds.

stop_tdTU :: (MonadPlus m, Monoid a) => TU a m -> TU a mSource

Top-down type-unifying traversal that is cut of below nodes where the argument strategy succeeds.

Single hit traversal

once_tdTP :: MonadPlus m => TP m -> TP mSource

Top-down type-preserving traversal that performs its argument strategy at most once.

once_tdTU :: MonadPlus m => TU a m -> TU a mSource

Top-down type-unifying traversal that performs its argument strategy at most once.

once_buTP :: MonadPlus m => TP m -> TP mSource

Bottom-up type-preserving traversal that performs its argument strategy at most once.

once_buTU :: MonadPlus m => TU a m -> TU a mSource

Bottom-up type-unifying traversal that performs its argument strategy at most once.

Traversal with environment propagation

once_peTUSource

Arguments

:: MonadPlus m 
=> e

initial environment

-> (e -> TU e m)

environment modification at downward step

-> (e -> TU a m)

extraction of value, dependent on environment

-> TU a m 

Top-down type-unifying traversal with propagation of an environment.

One-layer traversal

Defined versions of some primitive one-layer traversal combinators

anyTP' :: MonadPlus m => TP m -> TP mSource

Use anyTP instead.

someTP' :: MonadPlus m => TP m -> TP mSource

Use someTP instead.

Recursive completion of one-layer traversal

all_recTUSource

Arguments

:: (Monoid a, Monad m) 
=> (t -> TU a m -> TU a m)

binary strategy combinator

-> t

argument strategy

-> TU a m

result strategy

Recursive completion of full type-preserving one-layer traverasal

one_recTUSource

Arguments

:: MonadPlus m 
=> (t -> TU a m -> TU a m)

binary strategy combinator

-> t

argument strategy

-> TU a m

result strategy

Recursive completion of type-preserving one-layer traversal that succeeds exactly once.

Overloading and synonyms

Overloaded schemes for traversal

full_td :: StrategyMonoid s m => s m -> s mSource

Full top-down traversal (overloaded between TU and TP).

once_td :: StrategyPlus s m => s m -> s mSource

One-hit top-down traversal (overloaded between TU and TP).

once_bu :: StrategyPlus s m => s m -> s mSource

One-hit bottom-up traversal (overloaded between TU and TP).

once_pe :: StrategyPlus s m => (e -> s m) -> (e -> TU e m) -> e -> s mSource

One-hit top-down traversal with environment propagation (overloaded between TU and TP).

Some synonyms for convenience

topdown :: Monad m => TP m -> TP mSource

See full_tdTP.

crush :: (Monad m, Monoid u) => TU u m -> TU u mSource

See full_tdTU.

collect :: Monad m => TU [a] m -> TU [a] mSource

Type-specialised version of crush, which works with lists instead of any arbitrary monoid.

select :: MonadPlus m => TU u m -> TU u mSource

See once_tdTU.

selectenv :: MonadPlus m => e -> (e -> TU e m) -> (e -> TU a m) -> TU a mSource

See once_peTU.