The Components module defines thin wrappers around the Transducer
and Splitter
primitives and combinators,
relying on the Control.Concurrent.SCC.ComponentTypes module.
- type PerformerComponent m r = Component (Performer m r)
- type ConsumerComponent m x r = Component (Consumer m x r)
- type ProducerComponent m x r = Component (Producer m x r)
- type TransducerComponent m x y = Component (Transducer m x y)
- type ParserComponent m x y = Component (Parser m x y)
- type SplitterComponent m x b = Component (Splitter m x b)
- ioCost :: Int
- toList :: forall m x. Monad m => ConsumerComponent m x [x]
- fromList :: forall m x. Monad m => [x] -> ProducerComponent m x ()
- toStdOut :: ConsumerComponent IO Char ()
- fromStdIn :: ProducerComponent IO Char ()
- fromFile :: String -> ProducerComponent IO Char ()
- fromHandle :: Handle -> Bool -> ProducerComponent IO Char ()
- toFile :: String -> ConsumerComponent IO Char ()
- appendFile :: String -> ConsumerComponent IO Char ()
- toHandle :: Handle -> Bool -> ConsumerComponent IO Char ()
- id :: forall m x. Monad m => TransducerComponent m x x
- unparse :: forall m x y. Monad m => TransducerComponent m (Markup y x) x
- parse :: forall m x y. Monad m => TransducerComponent m x (Markup y x)
- suppress :: forall m x y. Monad m => ConsumerComponent m x ()
- erroneous :: forall m x. Monad m => String -> ConsumerComponent m x ()
- lowercase :: forall m. Monad m => TransducerComponent m Char Char
- uppercase :: forall m. Monad m => TransducerComponent m Char Char
- count :: forall m x. Monad m => TransducerComponent m x Integer
- toString :: forall m x. (Monad m, Show x) => TransducerComponent m x String
- group :: forall m x. Monad m => TransducerComponent m x [x]
- concatenate :: forall m x. Monad m => TransducerComponent m [x] x
- concatSeparate :: forall m x. Monad m => [x] -> TransducerComponent m [x] x
- whitespace :: forall m. Monad m => SplitterComponent m Char ()
- letters :: forall m. Monad m => SplitterComponent m Char ()
- digits :: forall m. Monad m => SplitterComponent m Char ()
- nonEmptyLine :: forall m. Monad m => SplitterComponent m Char ()
- line :: forall m. Monad m => SplitterComponent m Char ()
- everything :: forall m x. Monad m => SplitterComponent m x ()
- nothing :: forall m x. Monad m => SplitterComponent m x ()
- one :: forall m x. Monad m => SplitterComponent m x ()
- marked :: forall m x y. (Monad m, Eq y) => SplitterComponent m (Markup y x) ()
- markedContent :: forall m x y. (Monad m, Eq y) => SplitterComponent m (Markup y x) ()
- markedWith :: forall m x y. (Monad m, Eq y) => (y -> Bool) -> SplitterComponent m (Markup y x) ()
- contentMarkedWith :: forall m x y. (Monad m, Eq y) => (y -> Bool) -> SplitterComponent m (Markup y x) ()
- parseSubstring :: forall m x y. (Monad m, Eq x) => [x] -> ParserComponent m x OccurenceTag
- substring :: forall m x. (Monad m, Eq x) => [x] -> SplitterComponent m x ()
- consumeBy :: forall m x y r. Monad m => ConsumerComponent m x r -> TransducerComponent m x y
- (>->) :: PipeableComponentPair m w c1 c2 c3 => Component c1 -> Component c2 -> Component c3
- class CompatibleSignature c cons m input output | c -> cons m
- class AnyListOrUnit c
- data PerformerType r
- data ConsumerType r
- data ProducerType r
- data TransducerType
- join :: JoinableComponentPair t1 t2 t3 m x y c1 c2 c3 => Component c1 -> Component c2 -> Component c3
- sequence :: JoinableComponentPair t1 t2 t3 m x y c1 c2 c3 => Component c1 -> Component c2 -> Component c3
- prepend :: forall m x r. Monad m => ProducerComponent m x r -> TransducerComponent m x x
- append :: forall m x r. Monad m => ProducerComponent m x r -> TransducerComponent m x x
- substitute :: forall m x y r. Monad m => ProducerComponent m y r -> TransducerComponent m x y
- snot :: forall m x b. Monad m => SplitterComponent m x b -> SplitterComponent m x b
- (>&) :: forall m x b1 b2. MonadParallel m => SplitterComponent m x b1 -> SplitterComponent m x b2 -> SplitterComponent m x (b1, b2)
- (>|) :: forall m x b1 b2. MonadParallel m => SplitterComponent m x b1 -> SplitterComponent m x b2 -> SplitterComponent m x (Either b1 b2)
- (&&) :: forall m x b1 b2. MonadParallel m => SplitterComponent m x b1 -> SplitterComponent m x b2 -> SplitterComponent m x (b1, b2)
- (||) :: MonadParallel m => SplitterComponent m x b1 -> SplitterComponent m x b2 -> SplitterComponent m x (Either b1 b2)
- ifs :: forall c m x b. (MonadParallel m, Branching c m x ()) => SplitterComponent m x b -> Component c -> Component c -> Component c
- wherever :: forall m x b. MonadParallel m => TransducerComponent m x x -> SplitterComponent m x b -> TransducerComponent m x x
- unless :: forall m x b. MonadParallel m => TransducerComponent m x x -> SplitterComponent m x b -> TransducerComponent m x x
- select :: forall m x b. Monad m => SplitterComponent m x b -> TransducerComponent m x x
- parseRegions :: forall m x b. Monad m => SplitterComponent m x b -> ParserComponent m x b
- parseNestedRegions :: forall m x b. MonadParallel m => SplitterComponent m x (Boundary b) -> ParserComponent m x b
- while :: forall m x b. MonadParallel m => TransducerComponent m x x -> SplitterComponent m x b -> TransducerComponent m x x
- nestedIn :: forall m x b. MonadParallel m => SplitterComponent m x b -> SplitterComponent m x b -> SplitterComponent m x b
- foreach :: forall m x b c. (MonadParallel m, Branching c m x ()) => SplitterComponent m x b -> Component c -> Component c -> Component c
- having :: forall m x b1 b2. MonadParallel m => SplitterComponent m x b1 -> SplitterComponent m x b2 -> SplitterComponent m x b1
- havingOnly :: forall m x b1 b2. MonadParallel m => SplitterComponent m x b1 -> SplitterComponent m x b2 -> SplitterComponent m x b1
- first :: forall m x b. Monad m => SplitterComponent m x b -> SplitterComponent m x b
- uptoFirst :: forall m x b. Monad m => SplitterComponent m x b -> SplitterComponent m x b
- last :: forall m x b. Monad m => SplitterComponent m x b -> SplitterComponent m x b
- lastAndAfter :: forall m x b. Monad m => SplitterComponent m x b -> SplitterComponent m x b
- prefix :: forall m x b. Monad m => SplitterComponent m x b -> SplitterComponent m x b
- suffix :: forall m x b. Monad m => SplitterComponent m x b -> SplitterComponent m x b
- even :: forall m x b. Monad m => SplitterComponent m x b -> SplitterComponent m x b
- startOf :: forall m x b. Monad m => SplitterComponent m x b -> SplitterComponent m x (Maybe b)
- endOf :: forall m x b. MonadParallel m => SplitterComponent m x b -> SplitterComponent m x (Maybe b)
- followedBy :: forall m x b1 b2. MonadParallel m => SplitterComponent m x b1 -> SplitterComponent m x b2 -> SplitterComponent m x (b1, b2)
- (...) :: forall m x b1 b2. MonadParallel m => SplitterComponent m x b1 -> SplitterComponent m x b2 -> SplitterComponent m x b1
- xmlTokens :: Monad m => SplitterComponent m Char (Boundary Token)
- xmlParseTokens :: Monad m => ParserComponent m Char Token
- xmlElement :: Monad m => SplitterComponent m (Markup Token Char) ()
- xmlElementContent :: Monad m => SplitterComponent m (Markup Token Char) ()
- xmlElementHavingTag :: forall m b. MonadParallel m => SplitterComponent m (Markup Token Char) b -> SplitterComponent m (Markup Token Char) b
- xmlAttribute :: Monad m => SplitterComponent m (Markup Token Char) ()
- xmlElementName :: Monad m => SplitterComponent m (Markup Token Char) ()
- xmlAttributeName :: Monad m => SplitterComponent m (Markup Token Char) ()
- xmlAttributeValue :: Monad m => SplitterComponent m (Markup Token Char) ()
- xmlHavingText :: forall m b1 b2. MonadParallel m => SplitterComponent m (Markup Token Char) b1 -> SplitterComponent m Char b2 -> SplitterComponent m (Markup Token Char) b1
- xmlHavingOnlyText :: forall m b1 b2. MonadParallel m => SplitterComponent m (Markup Token Char) b1 -> SplitterComponent m Char b2 -> SplitterComponent m (Markup Token Char) b1
Documentation
type PerformerComponent m r = Component (Performer m r)Source
A component that performs a computation with no inputs nor outputs is a PerformerComponent
.
type ConsumerComponent m x r = Component (Consumer m x r)Source
A component that consumes values from a Source
is called ConsumerComponent
.
type ProducerComponent m x r = Component (Producer m x r)Source
A component that produces values and puts them into a Sink
is called ProducerComponent
.
type TransducerComponent m x y = Component (Transducer m x y)Source
The TransducerComponent
type represents computations that transform a data stream.
type ParserComponent m x y = Component (Parser m x y)Source
type SplitterComponent m x b = Component (Splitter m x b)Source
The SplitterComponent
type represents computations that distribute data acording to some criteria. A splitter
should distribute only the original input data, and feed it into the sinks in the same order it has been read from
the source. If the two 'Sink c x' arguments of a splitter are the same, the splitter must act as an identity
transform.
toList :: forall m x. Monad m => ConsumerComponent m x [x]Source
ConsumerComponent toList
copies the given source into a list.
fromList :: forall m x. Monad m => [x] -> ProducerComponent m x ()Source
fromList
produces the contents of the given list argument.
toStdOut :: ConsumerComponent IO Char ()Source
ConsumerComponent toStdOut
copies the given source into the standard output.
fromStdIn :: ProducerComponent IO Char ()Source
ProducerComponent fromStdIn
feeds the given sink from the standard input.
fromFile :: String -> ProducerComponent IO Char ()Source
ProducerComponent fromFile
opens the named file and feeds the given sink from its contents.
fromHandle :: Handle -> Bool -> ProducerComponent IO Char ()Source
ProducerComponent fromHandle
feeds the given sink from the open file handle. The argument doClose determines
| if handle should be closed when the handle is consumed or the sink closed.
toFile :: String -> ConsumerComponent IO Char ()Source
ConsumerComponent toFile
opens the named file and copies the given source into it.
appendFile :: String -> ConsumerComponent IO Char ()Source
ConsumerComponent appendFile
opens the name file and appends the given source to it.
toHandle :: Handle -> Bool -> ConsumerComponent IO Char ()Source
ConsumerComponent toHandle
copies the given source into the open file handle. The argument doClose determines
| if handle should be closed once the entire source is consumed and copied.
id :: forall m x. Monad m => TransducerComponent m x xSource
TransducerComponent id
passes its input through unmodified.
unparse :: forall m x y. Monad m => TransducerComponent m (Markup y x) xSource
TransducerComponent unparse
removes all markup from its input and passes the content through.
parse :: forall m x y. Monad m => TransducerComponent m x (Markup y x)Source
TransducerComponent parse
prepares input content for subsequent parsing.
suppress :: forall m x y. Monad m => ConsumerComponent m x ()Source
The suppress
consumer suppresses all input it receives. It is equivalent to substitute
[]
erroneous :: forall m x. Monad m => String -> ConsumerComponent m x ()Source
The erroneous
consumer reports an error if any input reaches it.
lowercase :: forall m. Monad m => TransducerComponent m Char CharSource
The lowercase
transforms all uppercase letters in the input to lowercase, leaving the rest unchanged.
uppercase :: forall m. Monad m => TransducerComponent m Char CharSource
The uppercase
transforms all lowercase letters in the input to uppercase, leaving the rest unchanged.
count :: forall m x. Monad m => TransducerComponent m x IntegerSource
The count
transducer counts all its input values and outputs the final tally.
toString :: forall m x. (Monad m, Show x) => TransducerComponent m x StringSource
Converts each input value x
to show x
.
group :: forall m x. Monad m => TransducerComponent m x [x]Source
TransducerComponent group
collects all its input values into a single list.
concatenate :: forall m x. Monad m => TransducerComponent m [x] xSource
TransducerComponent concatenate
flattens the input stream of lists of values into the output stream of values.
concatSeparate :: forall m x. Monad m => [x] -> TransducerComponent m [x] xSource
Same as concatenate
except it inserts the given separator list between every two input lists.
whitespace :: forall m. Monad m => SplitterComponent m Char ()Source
SplitterComponent whitespace
feeds all white-space characters into its true sink, all others into false.
letters :: forall m. Monad m => SplitterComponent m Char ()Source
SplitterComponent letters
feeds all alphabetical characters into its true sink, all other characters into
| false.
digits :: forall m. Monad m => SplitterComponent m Char ()Source
SplitterComponent digits
feeds all digits into its true sink, all other characters into false.
nonEmptyLine :: forall m. Monad m => SplitterComponent m Char ()Source
SplitterComponent nonEmptyLine
feeds line-ends into its false sink, and all other characters into true.
line :: forall m. Monad m => SplitterComponent m Char ()Source
The sectioning splitter line
feeds line-ends into its false sink, and line contents into true. A single
line-end can be formed by any of the character sequences "\n", "\r", "\r\n", or "\n\r".
everything :: forall m x. Monad m => SplitterComponent m x ()Source
SplitterComponent everything
feeds its entire input into its true sink.
nothing :: forall m x. Monad m => SplitterComponent m x ()Source
SplitterComponent nothing
feeds its entire input into its false sink.
one :: forall m x. Monad m => SplitterComponent m x ()Source
SplitterComponent one
feeds all input values to its true sink, treating every value as a separate section.
marked :: forall m x y. (Monad m, Eq y) => SplitterComponent m (Markup y x) ()Source
SplitterComponent marked
passes all marked-up input sections to its true sink, and all unmarked input to its
false sink.
markedContent :: forall m x y. (Monad m, Eq y) => SplitterComponent m (Markup y x) ()Source
SplitterComponent markedContent
passes the content of all marked-up input sections to its true sink, while the
outermost tags and all unmarked input go to its false sink.
markedWith :: forall m x y. (Monad m, Eq y) => (y -> Bool) -> SplitterComponent m (Markup y x) ()Source
SplitterComponent markedWith
passes input sections marked-up with the appropriate tag to its true sink, and the
rest of the input to its false sink. The argument select determines if the tag is appropriate.
contentMarkedWith :: forall m x y. (Monad m, Eq y) => (y -> Bool) -> SplitterComponent m (Markup y x) ()Source
SplitterComponent contentMarkedWith
passes the content of input sections marked-up with the appropriate tag to
its true sink, and the rest of the input to its false sink. The argument select determines if the tag is
appropriate.
parseSubstring :: forall m x y. (Monad m, Eq x) => [x] -> ParserComponent m x OccurenceTagSource
Performs the same task as the substring
splitter, but instead of splitting it outputs the input as
in order to distinguish overlapping strings.
Markup
x
OccurenceTag
substring :: forall m x. (Monad m, Eq x) => [x] -> SplitterComponent m x ()Source
SplitterComponent substring
feeds to its true sink all input parts that match the contents of the given list
argument. If two overlapping parts of the input both match the argument, both are sent to true and each is preceded
by an edge.
consumeBy :: forall m x y r. Monad m => ConsumerComponent m x r -> TransducerComponent m x ySource
Converts a ConsumerComponent
into a TransducerComponent
with no output.
(>->) :: PipeableComponentPair m w c1 c2 c3 => Component c1 -> Component c2 -> Component c3Source
Class PipeableComponentPair
applies to any two components that can be combined into a third component with the
following properties:
- The input of the result, if any, becomes the input of the first component.
- The output produced by the first child component is consumed by the second child component.
- The result output, if any, is the output of the second component.
class CompatibleSignature c cons m input output | c -> cons mSource
(AnyListOrUnit x, AnyListOrUnit y) => CompatibleSignature (Performer m r) (PerformerType r) m x y | |
CompatibleSignature (Transducer m x y) TransducerType m [x] [y] | |
AnyListOrUnit y => CompatibleSignature (Producer m x r) (ProducerType r) m y [x] | |
AnyListOrUnit y => CompatibleSignature (Consumer m x r) (ConsumerType r) m [x] y |
class AnyListOrUnit c Source
AnyListOrUnit () | |
AnyListOrUnit [x] |
data PerformerType r Source
(AnyListOrUnit x, AnyListOrUnit y) => CompatibleSignature (Performer m r) (PerformerType r) m x y |
data ConsumerType r Source
AnyListOrUnit y => CompatibleSignature (Consumer m x r) (ConsumerType r) m [x] y |
data ProducerType r Source
AnyListOrUnit y => CompatibleSignature (Producer m x r) (ProducerType r) m y [x] |
data TransducerType Source
CompatibleSignature (Transducer m x y) TransducerType m [x] [y] |
join :: JoinableComponentPair t1 t2 t3 m x y c1 c2 c3 => Component c1 -> Component c2 -> Component c3Source
Class JoinableComponentPair
applies to any two components that can be combined into a third component with the
following properties:
- if both argument components consume input, the input of the combined component gets distributed to both components in parallel,
- if both argument components produce output, the output of the combined component is a concatenation of the complete output from the first component followed by the complete output of the second component, and
- the
join
method may apply the components in any order, thesequence
method makes sure its first argument has completed before using the second one.
sequence :: JoinableComponentPair t1 t2 t3 m x y c1 c2 c3 => Component c1 -> Component c2 -> Component c3Source
prepend :: forall m x r. Monad m => ProducerComponent m x r -> TransducerComponent m x xSource
Combinator prepend
converts the given producer to transducer that passes all its input through unmodified, except
| for prepending the output of the argument producer to it.
| prepend
prefix = join
(substitute
prefix) asis
append :: forall m x r. Monad m => ProducerComponent m x r -> TransducerComponent m x xSource
Combinator append
converts the given producer to transducer that passes all its input through unmodified, finally
| appending to it the output of the argument producer.
| append
suffix = join
asis
(substitute
suffix)
substitute :: forall m x y r. Monad m => ProducerComponent m y r -> TransducerComponent m x ySource
The substitute
combinator converts its argument producer to a transducer that produces the same output, while
| consuming its entire input and ignoring it.
snot :: forall m x b. Monad m => SplitterComponent m x b -> SplitterComponent m x bSource
The snot
(streaming not) combinator simply reverses the outputs of the argument splitter. In other words, data
that the argument splitter sends to its true sink goes to the false sink of the result, and vice versa.
(>&) :: forall m x b1 b2. MonadParallel m => SplitterComponent m x b1 -> SplitterComponent m x b2 -> SplitterComponent m x (b1, b2)Source
The >&
combinator sends the true sink output of its left operand to the input of its right operand for further
splitting. Both operands' false sinks are connected to the false sink of the combined splitter, but any input
value to reach the true sink of the combined component data must be deemed true by both splitters.
(>|) :: forall m x b1 b2. MonadParallel m => SplitterComponent m x b1 -> SplitterComponent m x b2 -> SplitterComponent m x (Either b1 b2)Source
A >|
combinator's input value can reach its false sink only by going through both argument splitters' false
sinks.
(&&) :: forall m x b1 b2. MonadParallel m => SplitterComponent m x b1 -> SplitterComponent m x b2 -> SplitterComponent m x (b1, b2)Source
Combinator &&
is a pairwise logical conjunction of two splitters run in parallel on the same input.
(||) :: MonadParallel m => SplitterComponent m x b1 -> SplitterComponent m x b2 -> SplitterComponent m x (Either b1 b2)Source
Combinator ||
is a pairwise logical disjunction of two splitters run in parallel on the same input.
ifs :: forall c m x b. (MonadParallel m, Branching c m x ()) => SplitterComponent m x b -> Component c -> Component c -> Component cSource
wherever :: forall m x b. MonadParallel m => TransducerComponent m x x -> SplitterComponent m x b -> TransducerComponent m x xSource
unless :: forall m x b. MonadParallel m => TransducerComponent m x x -> SplitterComponent m x b -> TransducerComponent m x xSource
select :: forall m x b. Monad m => SplitterComponent m x b -> TransducerComponent m x xSource
parseRegions :: forall m x b. Monad m => SplitterComponent m x b -> ParserComponent m x bSource
Converts a splitter into a parser.
parseNestedRegions :: forall m x b. MonadParallel m => SplitterComponent m x (Boundary b) -> ParserComponent m x bSource
Converts a boundary-marking splitter into a parser.
while :: forall m x b. MonadParallel m => TransducerComponent m x x -> SplitterComponent m x b -> TransducerComponent m x xSource
The recursive combinator while
feeds the true sink of the argument splitter back to itself, modified by the
argument transducer. Data fed to the splitter's false sink is passed on unmodified.
nestedIn :: forall m x b. MonadParallel m => SplitterComponent m x b -> SplitterComponent m x b -> SplitterComponent m x bSource
The recursive combinator nestedIn
combines two splitters into a mutually recursive loop acting as a single
splitter. The true sink of one of the argument splitters and false sink of the other become the true and false sinks
of the loop. The other two sinks are bound to the other splitter's source. The use of nestedIn
makes sense only
on hierarchically structured streams. If we gave it some input containing a flat sequence of values, and assuming
both component splitters are deterministic and stateless, an input value would either not loop at all or it would
loop forever.
foreach :: forall m x b c. (MonadParallel m, Branching c m x ()) => SplitterComponent m x b -> Component c -> Component c -> Component cSource
The foreach
combinator is similar to the combinator ifs
in that it combines a splitter and two transducers into
another transducer. However, in this case the transducers are re-instantiated for each consecutive portion of the
input as the splitter chunks it up. Each contiguous portion of the input that the splitter sends to one of its two
sinks gets transducered through the appropriate argument transducer as that transducer's whole input. As soon as the
contiguous portion is finished, the transducer gets terminated.
having :: forall m x b1 b2. MonadParallel m => SplitterComponent m x b1 -> SplitterComponent m x b2 -> SplitterComponent m x b1Source
The having
combinator combines two pure splitters into a pure splitter. One splitter is used to chunk the input
into contiguous portions. Its false sink is routed directly to the false sink of the combined splitter. The
second splitter is instantiated and run on each portion of the input that goes to first splitter's true sink. If
the second splitter sends any output at all to its true sink, the whole input portion is passed on to the true
sink of the combined splitter, otherwise it goes to its false sink.
havingOnly :: forall m x b1 b2. MonadParallel m => SplitterComponent m x b1 -> SplitterComponent m x b2 -> SplitterComponent m x b1Source
The havingOnly
combinator is analogous to the having
combinator, but it succeeds and passes each chunk of the
input to its true sink only if the second splitter sends no part of it to its false sink.
first :: forall m x b. Monad m => SplitterComponent m x b -> SplitterComponent m x bSource
The result of combinator first
behaves the same as the argument splitter up to and including the first portion of
the input which goes into the argument's true sink. All input following the first true portion goes into the
false sink.
uptoFirst :: forall m x b. Monad m => SplitterComponent m x b -> SplitterComponent m x bSource
The result of combinator uptoFirst
takes all input up to and including the first portion of the input which goes
into the argument's true sink and feeds it to the result splitter's true sink. All the rest of the input goes
into the false sink. The only difference between first
and uptoFirst
combinators is in where they direct the
false portion of the input preceding the first true part.
last :: forall m x b. Monad m => SplitterComponent m x b -> SplitterComponent m x bSource
The result of the combinator last
is a splitter which directs all input to its false sink, up to the last
portion of the input which goes to its argument's true sink. That portion of the input is the only one that goes to
the resulting component's true sink. The splitter returned by the combinator last
has to buffer the previous two
portions of its input, because it cannot know if a true portion of the input is the last one until it sees the end of
the input or another portion succeeding the previous one.
lastAndAfter :: forall m x b. Monad m => SplitterComponent m x b -> SplitterComponent m x bSource
The result of the combinator lastAndAfter
is a splitter which directs all input to its false sink, up to the
last portion of the input which goes to its argument's true sink. That portion and the remainder of the input is
fed to the resulting component's true sink. The difference between last
and lastAndAfter
combinators is where
they feed the false portion of the input, if any, remaining after the last true part.
prefix :: forall m x b. Monad m => SplitterComponent m x b -> SplitterComponent m x bSource
The prefix
combinator feeds its true sink only the prefix of the input that its argument feeds to its true
sink. All the rest of the input is dumped into the false sink of the result.
suffix :: forall m x b. Monad m => SplitterComponent m x b -> SplitterComponent m x bSource
The suffix
combinator feeds its true sink only the suffix of the input that its argument feeds to its true
sink. All the rest of the input is dumped into the false sink of the result.
even :: forall m x b. Monad m => SplitterComponent m x b -> SplitterComponent m x bSource
startOf :: forall m x b. Monad m => SplitterComponent m x b -> SplitterComponent m x (Maybe b)Source
SplitterComponent startOf
issues an empty true section at the beginning of every section considered true by
its argument splitter, otherwise the entire input goes into its false sink.
endOf :: forall m x b. MonadParallel m => SplitterComponent m x b -> SplitterComponent m x (Maybe b)Source
SplitterComponent endOf
issues an empty true section at the end of every section considered true by its
argument splitter, otherwise the entire input goes into its false sink.
followedBy :: forall m x b1 b2. MonadParallel m => SplitterComponent m x b1 -> SplitterComponent m x b2 -> SplitterComponent m x (b1, b2)Source
Combinator followedBy
treats its argument SplitterComponent
s as patterns components and returns a SplitterComponent
that
matches their concatenation. A section of input is considered true by the result iff its prefix is considered
true by argument s1 and the rest of the section is considered true by s2. The splitter s2 is started anew
after every section split to true sink by s1.
(...) :: forall m x b1 b2. MonadParallel m => SplitterComponent m x b1 -> SplitterComponent m x b2 -> SplitterComponent m x b1Source
Combinator ...
tracks the running balance of difference between the number of preceding starts of sections
considered true according to its first argument and the ones according to its second argument. The combinator
passes to true all input values for which the difference balance is positive. This combinator is typically used
with startOf
and endOf
in order to count entire input sections and ignore their lengths.
xmlParseTokens :: Monad m => ParserComponent m Char TokenSource
xmlElement :: Monad m => SplitterComponent m (Markup Token Char) ()Source
xmlElementContent :: Monad m => SplitterComponent m (Markup Token Char) ()Source
xmlElementHavingTag :: forall m b. MonadParallel m => SplitterComponent m (Markup Token Char) b -> SplitterComponent m (Markup Token Char) bSource
Similiar to (
, except it runs the argument splitter
only on each element's start tag, not on the entire element with its content.
Control.Concurrent.SCC.Combinators.having
element
)
xmlAttribute :: Monad m => SplitterComponent m (Markup Token Char) ()Source
Splits every attribute specification to true, everything else to false.
xmlElementName :: Monad m => SplitterComponent m (Markup Token Char) ()Source
Splits every element name, including the names of nested elements and names in end tags, to true, all the rest of input to false.
xmlAttributeName :: Monad m => SplitterComponent m (Markup Token Char) ()Source
Splits every attribute name to true, all the rest of input to false.
xmlAttributeValue :: Monad m => SplitterComponent m (Markup Token Char) ()Source
Splits every attribute value, excluding the quote delimiters, to true, all the rest of input to false.
xmlHavingText :: forall m b1 b2. MonadParallel m => SplitterComponent m (Markup Token Char) b1 -> SplitterComponent m Char b2 -> SplitterComponent m (Markup Token Char) b1Source
xmlHavingOnlyText :: forall m b1 b2. MonadParallel m => SplitterComponent m (Markup Token Char) b1 -> SplitterComponent m Char b2 -> SplitterComponent m (Markup Token Char) b1Source