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
- put :: [i] -> Phase p i o ()
- put1 :: i -> Phase p i o ()
- count :: (p -> p) -> Phase p i o ()
- yield :: o -> Phase p i o ()
- eof :: Phase p i o ()
- (<??>) :: ([String] -> [String]) -> Phase p i o a -> Phase p i o a
- (<?>) :: [Char] -> 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]
- parse1_ :: 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.
put1 :: i -> Phase p i o () Source #
Insert one value back into the input. May be used for implementing lookahead
(<??>) :: ([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. Depreciated because it doesn't work correctly for all
arguments and fixing it would break the Alternative
and MonadPlus
instances.
(<?>) :: [Char] -> Phase p i o a -> Phase p i o a infixr 1 Source #
If parsing fails in the right argument: prepend the left argument to the errors
(>#>) :: ((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.
parse1_ :: p -> Phase p i o a -> i -> Either [(p, [String])] [a] Source #
Use a Phase
as a parser, but consuming a single input instead of a list
options :: Automaton p i o a -> [Automaton p i o a] Source #
Decompose an Automaton
into its component options.