-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Generic types and functions for columnar encoding and decoding -- -- Please see README.md @package siphon @version 0.1 module Siphon.Types newtype Escaped c Escaped :: c -> Escaped c [getEscaped] :: Escaped c -> c data Siphon c Siphon :: !(c -> Escaped c) -> !(Vector (Escaped c) -> c) -> (c -> IResult c (Vector c)) -> (c -> Bool) -> Siphon c [siphonEscape] :: Siphon c -> !(c -> Escaped c) [siphonIntercalate] :: Siphon c -> !(Vector (Escaped c) -> c) [siphonParseRow] :: Siphon c -> c -> IResult c (Vector c) [siphonNull] :: Siphon c -> c -> Bool module Siphon.Text siphon :: Siphon Text encodeRow :: Vector (Escaped Text) -> Text escape :: Text -> Escaped Text escapeAlways :: Text -> Escaped Text module Siphon.Internal.Text text :: Siphon Text encodeRow :: Vector (Escaped Text) -> Text escape :: Text -> Escaped Text -- | This implementation is definitely suboptimal. A better option (which -- would waste a little space but would be much faster) would be to build -- the new text by writing to a buffer directly. escapeAlways :: Text -> Escaped Text -- | Specialized version of sepBy1' which is faster due to not -- accepting an arbitrary separator. sepByDelim1' :: Parser a -> Char -> Parser [a] -- | Specialized version of sepBy1' which is faster due to not -- accepting an arbitrary separator. sepByEndOfLine1' :: Parser a -> Parser [a] -- | Parse a record, not including the terminating line separator. The -- terminating line separate is not included as the last record in a CSV -- file is allowed to not have a terminating line separator. You most -- likely want to use the endOfLine parser in combination with -- this parser. row :: Char -> Parser (Vector Text) rowNoNewline :: Char -> Parser (Vector Text) -- | Parse a field. The field may be in either the escaped or non-escaped -- format. The return value is unescaped. field :: Char -> Parser Text escapedField :: Parser Text escapedFieldInner :: Builder -> Parser Builder unescapedField :: Char -> Parser Text dquote :: Parser Char unescape :: Parser Text -- | A strict version of <$> for monads. (<$!>) :: Monad m => (a -> b) -> m a -> m b infixl 4 <$!> -- | A version of liftM2 that is strict in the result of its first -- action. liftM2' :: (Monad m) => (a -> b -> c) -> m a -> m b -> m c -- | Match either a single newline character '\n', or a carriage -- return followed by a newline character "\r\n", or a single -- carriage return '\r'. endOfLine :: Parser () textDoubleQuote :: Text doubleQuote :: Char newline :: Char cr :: Char comma :: Char -- | A CSV parser. The parser defined here is RFC 4180 compliant, with the -- following extensions: -- -- -- -- The functions in this module can be used to implement e.g. a resumable -- parser that is fed input incrementally. module Siphon.Internal byteStringChar8 :: Siphon ByteString encodeRow :: Vector (Escaped ByteString) -> ByteString escape :: ByteString -> Escaped ByteString -- | This implementation is definitely suboptimal. A better option (which -- would waste a little space but would be much faster) would be to build -- the new bytestring by writing to a buffer directly. escapeAlways :: ByteString -> Escaped ByteString -- | Specialized version of sepBy1' which is faster due to not -- accepting an arbitrary separator. sepByDelim1' :: Parser a -> Word8 -> Parser [a] -- | Specialized version of sepBy1' which is faster due to not -- accepting an arbitrary separator. sepByEndOfLine1' :: Parser a -> Parser [a] -- | Parse a record, not including the terminating line separator. The -- terminating line separate is not included as the last record in a CSV -- file is allowed to not have a terminating line separator. You most -- likely want to use the endOfLine parser in combination with -- this parser. row :: Word8 -> Parser (Vector ByteString) rowNoNewline :: Word8 -> Parser (Vector ByteString) removeBlankLines :: [Vector ByteString] -> [Vector ByteString] -- | Parse a field. The field may be in either the escaped or non-escaped -- format. The return value is unescaped. field :: Word8 -> Parser ByteString escapedField :: Parser ByteString unescapedField :: Word8 -> Parser ByteString dquote :: Parser Char -- | This could be improved. We could avoid the builder and just write to a -- buffer directly. unescape :: Parser ByteString -- | A strict version of <$> for monads. (<$!>) :: Monad m => (a -> b) -> m a -> m b infixl 4 <$!> -- | Is this an empty record (i.e. a blank line)? blankLine :: Vector ByteString -> Bool -- | A version of liftM2 that is strict in the result of its first -- action. liftM2' :: (Monad m) => (a -> b -> c) -> m a -> m b -> m c -- | Match either a single newline character '\n', or a carriage -- return followed by a newline character "\r\n", or a single -- carriage return '\r'. endOfLine :: Parser () doubleQuote :: Word8 newline :: Word8 cr :: Word8 comma :: Word8 module Siphon.Encoding row :: Siphon c -> Encoding f c a -> a -> c header :: Siphon c -> Encoding Headed c a -> c pipe :: Monad m => Siphon c -> Encoding f c a -> Pipe a c m x headedPipe :: Monad m => Siphon c -> Encoding Headed c a -> Pipe a c m x module Siphon.Decoding mkParseError :: Int -> [String] -> String -> DecodingRowError f content -- | This is a convenience function for working with pipes-text. -- It will convert a UTF-8 decoding error into a DecodingRowError, -- so the pipes can be properly chained together. convertDecodeError :: String -> Either (Producer ByteString m ()) () -> Maybe (DecodingRowError f c) -- | This is seldom useful but is included for completeness. headlessPipe :: Monad m => Siphon c -> Decoding Headless c a -> Pipe c a m (DecodingRowError Headless c) indexedPipe :: Monad m => Siphon c -> Decoding (Indexed Headless) c a -> Pipe c a m (DecodingRowError Headless c) headedPipe :: (Monad m, Eq c) => Siphon c -> Decoding Headed c a -> Pipe c a m (DecodingRowError Headed c) uncheckedPipe :: Monad m => Int -> Int -> Siphon c -> Decoding (Indexed f) c a -> Maybe c -> Pipe c a m (DecodingRowError f c) consumeGeneral :: Monad m => Int -> Siphon c -> (Int -> [String] -> String -> e) -> Consumer' c m (Either e (Vector c, Maybe c)) pipeGeneral :: Monad m => Int -> Siphon c -> (Int -> [String] -> String -> e) -> (Int -> Vector c -> Either e a) -> Maybe c -> Pipe c a m e awaitSkip :: Monad m => (a -> Bool) -> Consumer' a m a module Siphon.Content byteStringChar8 :: Siphon ByteString text :: Siphon Text module Siphon.ByteString.Char8 module Siphon