Maintainer | bastiaan.heeren@ou.nl |
---|---|
Stability | provisional |
Portability | portable (depends on ghc) |
Safe Haskell | None |
Language | Haskell98 |
A collection of strategy combinators: all lifted to work on different data types
- (.*.) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a
- (.|.) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a
- (.%.) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a
- (.@.) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a
- (!~>) :: IsStrategy f => Rule a -> f a -> Strategy a
- inits :: IsStrategy f => f a -> Strategy a
- succeed :: Strategy a
- fail :: Strategy a
- atomic :: IsStrategy f => f a -> Strategy a
- sequence :: IsStrategy f => [f a] -> Strategy a
- choice :: IsStrategy f => [f a] -> Strategy a
- interleave :: IsStrategy f => [f a] -> Strategy a
- noInterleaving :: IsStrategy f => f a -> Strategy a
- interleaveId :: Id
- permute :: IsStrategy f => [f a] -> Strategy a
- many :: IsStrategy f => f a -> Strategy a
- many1 :: IsStrategy f => f a -> Strategy a
- replicate :: IsStrategy f => Int -> f a -> Strategy a
- option :: IsStrategy f => f a -> Strategy a
- check :: (a -> Bool) -> Strategy a
- not :: IsStrategy f => f a -> Strategy a
- repeat :: IsStrategy f => f a -> Strategy a
- repeat1 :: IsStrategy f => f a -> Strategy a
- try :: IsStrategy f => f a -> Strategy a
- (./.) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a
- (|>) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a
- while :: IsStrategy f => (a -> Bool) -> f a -> Strategy a
- until :: IsStrategy f => (a -> Bool) -> f a -> Strategy a
- exhaustive :: IsStrategy f => [f a] -> Strategy a
- dynamic :: (IsId n, IsStrategy f, IsTerm a) => n -> (a -> f a) -> Strategy a
- type DependencyGraph node key = [(node, key, [key])]
- dependencyGraph :: (IsStrategy f, Ord key) => DependencyGraph (f a) key -> Strategy a
Documentation
(.*.) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a infixr 5 Source #
Put two strategies in sequence (first do this, then do that)
(.|.) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a infixr 3 Source #
Choose between the two strategies (either do this or do that)
(.%.) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a infixr 2 Source #
Interleave two strategies
(.@.) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a infixr 2 Source #
Alternate two strategies
(!~>) :: IsStrategy f => Rule a -> f a -> Strategy a infixr 5 Source #
Prefixing a basic rule to a strategy atomically
inits :: IsStrategy f => f a -> Strategy a Source #
Initial prefixes (allows the strategy to stop succesfully at any time)
atomic :: IsStrategy f => f a -> Strategy a Source #
Makes a strategy atomic (w.r.t. parallel composition)
sequence :: IsStrategy f => [f a] -> Strategy a Source #
Puts a list of strategies into a sequence
choice :: IsStrategy f => [f a] -> Strategy a Source #
Combines a list of alternative strategies
interleave :: IsStrategy f => [f a] -> Strategy a Source #
Merges a list of strategies (in parallel)
noInterleaving :: IsStrategy f => f a -> Strategy a Source #
interleaveId :: Id Source #
permute :: IsStrategy f => [f a] -> Strategy a Source #
Allows all permutations of the list
many :: IsStrategy f => f a -> Strategy a Source #
Repeat a strategy zero or more times (non-greedy)
many1 :: IsStrategy f => f a -> Strategy a Source #
Apply a certain strategy at least once (non-greedy)
replicate :: IsStrategy f => Int -> f a -> Strategy a Source #
Apply a strategy a certain number of times
option :: IsStrategy f => f a -> Strategy a Source #
Apply a certain strategy or do nothing (non-greedy)
check :: (a -> Bool) -> Strategy a Source #
Checks whether a predicate holds for the current term. The check is considered to be a minor step.
not :: IsStrategy f => f a -> Strategy a Source #
Check whether or not the argument strategy cannot be applied: the result strategy only succeeds if this is not the case (otherwise it fails).
repeat :: IsStrategy f => f a -> Strategy a Source #
Repeat a strategy zero or more times (greedy version of many
)
repeat1 :: IsStrategy f => f a -> Strategy a Source #
Apply a certain strategy at least once (greedy version of many1
)
try :: IsStrategy f => f a -> Strategy a Source #
Apply a certain strategy if this is possible (greedy version of option
)
(./.) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a infixr 4 Source #
Choose between the two strategies, with a preference for steps from the left hand-side strategy.
(|>) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a infixr 4 Source #
Left-biased choice: if the left-operand strategy can be applied, do so. Otherwise, try the right-operand strategy
while :: IsStrategy f => (a -> Bool) -> f a -> Strategy a Source #
Repeat the strategy as long as the predicate holds
until :: IsStrategy f => (a -> Bool) -> f a -> Strategy a Source #
Repeat the strategy until the predicate holds
exhaustive :: IsStrategy f => [f a] -> Strategy a Source #
Apply the strategies from the list exhaustively (until this is no longer possible)
dynamic :: (IsId n, IsStrategy f, IsTerm a) => n -> (a -> f a) -> Strategy a Source #
The structure of a dynamic strategy depends on the current term
type DependencyGraph node key = [(node, key, [key])] Source #
dependencyGraph :: (IsStrategy f, Ord key) => DependencyGraph (f a) key -> Strategy a Source #
Create a strategy from a dependency graph with strategies as nodes Does not check for cycles