Copyright | Jeremy List |
---|---|
License | BSD-3 |
Maintainer | quick.dudley@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
Core functions and types.
- data Automaton p i o a
- data Phase p i o a
- class Link s d l | s d -> l where
- get :: Phase p i o i
- count :: (p -> p) -> Phase p i o ()
- yield :: o -> Phase p i o ()
- (<??>) :: ([String] -> [String]) -> Phase p i o a -> Phase p i o a
- (>#>) :: ((p0 -> p0) -> p -> p) -> Phase p0 i o a -> Phase p i o a
- starve :: Automaton p i o a -> Automaton p z o a
- toAutomaton :: Phase p i o a -> Automaton p i o a
- fromAutomaton :: Automaton p i o a -> Phase p i o a
- beforeStep :: Automaton p i o a -> Either (Automaton p v o a) (Automaton p i o a)
- step :: Automaton p i o a -> i -> Automaton p i o a
- extract :: p -> Automaton p i o a -> Either [(p, [String])] [a]
- toReadS :: Automaton p i o a -> [i] -> [(a, [i])]
- run :: Automaton p i o a -> [i] -> Automaton p i o a
- parse_ :: p -> Phase p i o a -> [i] -> Either [(p, [String])] [a]
- options :: Automaton p i o a -> [Automaton p i o a]
- readCount :: Automaton p i o a -> (p -> p, Automaton p i o a)
- outputs :: Automaton p i o a -> ([o], Automaton p i o a)
Documentation
data Automaton p i o a Source #
Represents a nondeterministic computation in progress. There are 4 type parameters: a counter type (may be used for tracking line and column numbers), an input type, an incremental output type, and a final output type.
A type for building Automaton
values. Monad
and Applicative
instances
are defined for this type rather than for Automaton
in order to avoid
traversing the entire call stack for every input value.
class Link s d l | s d -> l where Source #
Class for types which consume and produce incremental input and output.
(<??>) :: ([String] -> [String]) -> Phase p i o a -> Phase p i o a infixr 1 Source #
When the right argument fails: apply the left argument to the list of error messages.
(>#>) :: ((p0 -> p0) -> p -> p) -> Phase p0 i o a -> Phase p i o a infixr 1 Source #
Change the counter type of a Phase object.
starve :: Automaton p i o a -> Automaton p z o a Source #
Remove an Automaton'
s ability to consume further input
toAutomaton :: Phase p i o a -> Automaton p i o a Source #
fromAutomaton :: Automaton p i o a -> Phase p i o a Source #
extract :: p -> Automaton p i o a -> Either [(p, [String])] [a] Source #
Take either counters with errors or a list of possible results from an automaton.
run :: Automaton p i o a -> [i] -> Automaton p i o a Source #
Pass a list of input values to an Automaton
parse_ :: p -> Phase p i o a -> [i] -> Either [(p, [String])] [a] Source #
Use a Phase
value similarly to a parser.
options :: Automaton p i o a -> [Automaton p i o a] Source #
Decompose an Automaton
into its component options.