Text.Delimited
Description
Parse text files containing lines with records separated by character delimiters.
At this time parsing is only supported for lazy ByteStrings.
- encode :: Char -> Content -> ByteString
- decode :: [Char] -> ByteString -> Result Content
- interact :: (Record -> Record) -> [Char] -> ByteString -> Result ByteString
- type Content = [Record]
- type Record = [Field]
- type Field = ByteString
- type Result a = Either ParseError a
Documentation
encode :: Char -> Content -> ByteStringSource
Encode records separated by newlines to a ByteString.
Record fields are separated by delim.
decode :: [Char] -> ByteString -> Result ContentSource
Parse records separated by newlines from a ByteString.
Record fields are separated by any of the characters in delims. There is
no way of escaping delimiters, so record fields may not contain any of the
characters in delims.
interact :: (Record -> Record) -> [Char] -> ByteString -> Result ByteStringSource
Decode a ByteString, apply a function to each Record and encode the content.
Delimiters may contain multiple characters but only the first is used for
encoding.
A record is a series of fields. Each record is located on a separate line, delimited by a line break (CRLF).
type Field = ByteStringSource
A field is a strict ByteString.