Module Components defines primitive components of Producer
, Consumer
, Transducer
and Splitter
types,
defined in the Foundation and ComponentTypes modules.
 fromFile :: String > Producer IO Char ()
 fromHandle :: Handle > Producer IO Char ()
 fromStdIn :: Producer IO Char ()
 appendFile :: String > Consumer IO Char ()
 toFile :: String > Consumer IO Char ()
 toHandle :: Handle > Consumer IO Char ()
 toStdOut :: Consumer IO Char ()
 toPrint :: forall x. (Show x, Typeable x) => Consumer IO x ()
 asis :: (Monad m, Typeable x) => Transducer m x x
 suppress :: (Monad m, Typeable x, Typeable y) => Transducer m x y
 erroneous :: (Monad m, Typeable x) => Transducer m x x
 prepend :: (Monad m, Typeable x) => [x] > Transducer m x x
 append :: (Monad m, Typeable x) => [x] > Transducer m x x
 substitute :: (Monad m, Typeable x, Typeable y) => [y] > Transducer m x y
 allTrue :: (Monad m, Typeable x) => Splitter m x
 allFalse :: (Monad m, Typeable x) => Splitter m x
 one :: (Monad m, Typeable x) => Splitter m x
 substring :: (Monad m, Eq x, Typeable x) => [x] > Splitter m x
 substringMatch :: (Monad m, Eq x, Typeable x) => [x] > Splitter m x
 group :: (Monad m, Typeable x) => Transducer m x [x]
 concatenate :: (Monad m, Typeable x) => Transducer m [x] x
 concatSeparate :: (Monad m, Typeable x) => [x] > Transducer m [x] x
 lowercase :: Monad m => Transducer m Char Char
 uppercase :: Monad m => Transducer m Char Char
 whitespace :: Monad m => Splitter m Char
 letters :: Monad m => Splitter m Char
 digits :: Monad m => Splitter m Char
 line :: Monad m => Splitter m Char
 nonEmptyLine :: Monad m => Splitter m Char
 count :: (Monad m, Typeable x) => Transducer m x Integer
 toString :: (Monad m, Show x, Typeable x) => Transducer m x String
IO components
fromFile :: String > Producer IO Char ()Source
Producer fromFile
opens the named file and feeds the given sink from its contents.
fromHandle :: Handle > Producer IO Char ()Source
Producer fromHandle
feeds the given sink from the open file handle.
fromStdIn :: Producer IO Char ()Source
Producer fromStdIn
feeds the given sink from the standard input.
appendFile :: String > Consumer IO Char ()Source
Consumer appendFile
opens the name file and appends the given source to it.
toFile :: String > Consumer IO Char ()Source
Consumer toFile
opens the named file and copies the given source into it.
toHandle :: Handle > Consumer IO Char ()Source
Consumer toHandle
copies the given source into the open file handle.
toStdOut :: Consumer IO Char ()Source
Consumer toStdOut
copies the given source into the standard output.
Generic transducers
asis :: (Monad m, Typeable x) => Transducer m x xSource
Transducer asis
passes its input through unmodified.
suppress :: (Monad m, Typeable x, Typeable y) => Transducer m x ySource
The suppress
transducer suppresses all input it receives. It is equivalent to substitute
[]
erroneous :: (Monad m, Typeable x) => Transducer m x xSource
The erroneous
transducer reports an error if any input reaches it.
prepend :: (Monad m, Typeable x) => [x] > Transducer m x xSource
Transducer prepend
passes its input unmodified, except for prepending contents of the given list parameter before
it.
append :: (Monad m, Typeable x) => [x] > Transducer m x xSource
Transducer append
passes its input unmodified, except for appending contents of the given list parameter to
its end.
substitute :: (Monad m, Typeable x, Typeable y) => [y] > Transducer m x ySource
The substitute
transducer replaces its whole input by its parameter.
Generic splitters
allTrue :: (Monad m, Typeable x) => Splitter m xSource
Splitter allTrue
feeds its entire input into its true sink.
allFalse :: (Monad m, Typeable x) => Splitter m xSource
Splitter allFalse
feeds its entire input into its false sink.
one :: (Monad m, Typeable x) => Splitter m xSource
Splitter one
feeds all input values to its true sink, treating every value as a separate section.
substring :: (Monad m, Eq x, Typeable x) => [x] > Splitter m xSource
Splitter 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, only the first one wins.
substringMatch :: (Monad m, Eq x, Typeable x) => [x] > Splitter m xSource
Splitter substringMatch
feeds to its true sink all input parts that match the contents of the given list
argument. If two overlapping parts of the input match the argument, both are considered true.
List transducers
The following laws hold:

group
>>
concatenate
==asis

concatenate
==concatSeparate
[]
group :: (Monad m, Typeable x) => Transducer m x [x]Source
Transducer group
collects all its input values into a single list.
concatenate :: (Monad m, Typeable x) => Transducer m [x] xSource
Transducer concatenate
flattens the input stream of lists of values into the output stream of values.
concatSeparate :: (Monad m, Typeable x) => [x] > Transducer m [x] xSource
Character stream components
lowercase :: Monad m => Transducer m Char CharSource
The lowercase
transforms all uppercase letters in the input to lowercase, leaving the rest unchanged.
uppercase :: Monad m => Transducer m Char CharSource
The uppercase
transforms all lowercase letters in the input to uppercase, leaving the rest unchanged.
whitespace :: Monad m => Splitter m CharSource
Splitter whitespace
feeds all whitespace characters into its true sink, all others into false.
letters :: Monad m => Splitter m CharSource
Splitter letters
feeds all alphabetical characters into its true sink, all other characters into false.
digits :: Monad m => Splitter m CharSource
Splitter digits
feeds all digits into its true sink, all other characters into false.
line :: Monad m => Splitter m CharSource
The sectioning splitter line
feeds lineends into its false sink, and line contents into true. A single
lineend can be formed by any of the character sequences "\n", "\r", "\r\n", or "\n\r".
nonEmptyLine :: Monad m => Splitter m CharSource
Splitter nonEmptyLine
feeds lineends into its false sink, and all other characters into true.