delimited-text-0.3.0: Parse character delimited textual data

Text.Delimited

Description

Parse text files containing lines with records separated by character delimiters.

At this time parsing is only supported for lazy ByteStrings.

Synopsis

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.

type Content = [Record]Source

A delimited file is a series of variable length records.

type Record = [Field]Source

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.

type Result a = Either ParseError aSource

Result type.