-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A fast, but bare bones, bytestring parser combinators library. -- -- Please see README.md @package fastparser @version 0.3.1.2 -- | A fast parser combinators module. -- -- This module is extremely bare-bones, and provides only very limited -- functionality. -- -- Sample usage: -- --
--   module Syslog where
--   
--   import ByteString.Parser.Fast
--   import qualified Data.ByteString as BS
--   import Data.Thyme.Clock
--   import Control.Applicative
--   
--   data SyslogMsg
--       = SyslogMsg
--       { _syslogPrio    :: {-# UNPACK #-} !Int
--       , _syslogTS      :: {-# UNPACK #-} !UTCTime
--       , _syslogHost    :: !BS.ByteString
--       , _syslogProgram :: !BS.ByteString
--       , _syslogPID     :: !(Maybe Int)
--       , _syslogData    :: !BS.ByteString
--       } deriving (Show, Eq)
--   
--   
--   syslogMsg :: Parser SyslogMsg
--   syslogMsg = do
--       char '<'
--       prio <- decimal
--       char '>'
--       ts <- rfc3339
--       char ' '
--       host <- charTakeWhile1 (/= ' ')
--       char ' '
--       program <- charTakeWhile1 (\x -> x /= ':' && x /= '[')
--       pid' <- optional (char '[' *> decimal <* char ']')
--       char ':'
--       dt <- remaining
--       return (SyslogMsg prio ts host program pid' dt)
--   
--   test :: BS.ByteString -> Either ParseError SyslogMsg
--   test = parseOnly syslogMsg
--   
module ByteString.Parser.Fast type Parser = Codensity ParserM -- | A parser, church encoded. The arguments to the wrapped function are: -- -- newtype ParserM a Parser :: (forall r. ByteString -> (ParseError -> r) -> (ByteString -> a -> r) -> r) -> ParserM a [runParser] :: ParserM a -> forall r. ByteString -> (ParseError -> r) -> (ByteString -> a -> r) -> r -- | Runs the parser. Will return a parse error if the parser fails or if -- the input is not completely consumed. parseOnly :: Parser a -> ByteString -> Either ParseError a data ParseError ParseError :: !Set ErrorItem -> !Set ErrorItem -> ParseError [errorUnexpected] :: ParseError -> !Set ErrorItem [errorExpected] :: ParseError -> !Set ErrorItem data ErrorItem Tokens :: ByteString -> ErrorItem Label :: String -> ErrorItem -- | An error representing the unexpected end of input. ueof :: ParseError -- | A generic error. ufail :: String -> ParseError -- | Creates a generic parse error. parseError :: ByteString -> ByteString -> ParseError -- | parses a decimal integer. decimal :: Parser Int -- | Parses any positive decimal Num. num :: Num n => Parser n -- | Parses any positive hexadecimal Num. hnum :: Num n => Parser n -- | Parses any positives octal Num. onum :: Num n => Parser n -- | Parses Fractional numbers. frac :: Fractional a => Parser a -- | A fast parser for numbers of the form 5.123. Contrary to what its name -- implies, it parses to Double. scientific :: Parser Double -- | Parses a character satisfying a predicate satisfy :: (Char -> Bool) -> Parser Char -- | Parses any character. anyChar :: Parser Char -- | Parses a specific character. char :: Char -> Parser () -- | Parses the supplied string. string :: ByteString -> Parser () -- | Parses strings between double quotes. This functions handles the -- following escape sequences: \r, \n, \t, \a, \b, \", \\. quotedString :: Parser ByteString -- | Consumes n bytes of input takeN :: Int -> Parser ByteString -- | Parses the remaining input. remaining :: Parser ByteString -- | Consumes the input as long as the predicate remains true. charTakeWhile :: (Char -> Bool) -> Parser ByteString charTakeWhile1 :: (Char -> Bool) -> Parser ByteString -- | Consumes the input as long as the predicate remains true. takeWhile :: (Word8 -> Bool) -> Parser ByteString takeWhile1 :: (Word8 -> Bool) -> Parser ByteString -- | Discards the input as long as the predicate remains true. skipWhile :: (Word8 -> Bool) -> Parser () -- | Parses days, with format YYYY-MM-DD parseYMD :: Parser Day -- | Parses a difftime, with format HH:MM:SS parseDTime :: Parser DiffTime -- | Parses a whole timestamp, with format YYYY-MM-DD+HH:MM:SS+CEST. This -- is very much *not* robust, as it only handles CET and CEST. timestamp :: Parser UTCTime -- | Parses RFC3339 compatible timestamps to UTCTime. rfc3339 :: Parser UTCTime -- | Creates a parser from the supplied function. The first argument to the -- supplied function is the remaining input, and it should return -- Nothing when parsing failes, or Just the result along -- with the non-consumed input. -- -- It works well with the bytestring-lexing library. wlex :: (ByteString -> Maybe (a, ByteString)) -> Parser a -- | Turns any parser into a SimpleFold. pFold :: Parser a -> SimpleFold ByteString a -- | Returns true when the character represents an ASCII lowercase letter. isLower :: Word8 -> Bool -- | Parses bytestrings as if they were representing an octal number in -- ASCII. getOctal :: ByteString -> Int -- | Parses bytestrings as if they were representing a decimal number in -- ASCII. getInt :: ByteString -> Int instance GHC.Base.Functor ByteString.Parser.Fast.ParserM instance GHC.Classes.Eq ByteString.Parser.Fast.ParseError instance GHC.Show.Show ByteString.Parser.Fast.ParseError instance GHC.Classes.Ord ByteString.Parser.Fast.ErrorItem instance GHC.Classes.Eq ByteString.Parser.Fast.ErrorItem instance GHC.Show.Show ByteString.Parser.Fast.ErrorItem instance GHC.Base.Applicative ByteString.Parser.Fast.ParserM instance GHC.Base.Alternative ByteString.Parser.Fast.ParserM instance GHC.Base.Monad ByteString.Parser.Fast.ParserM instance GHC.Base.MonadPlus ByteString.Parser.Fast.ParserM instance GHC.Base.Semigroup ByteString.Parser.Fast.ParseError instance GHC.Base.Monoid ByteString.Parser.Fast.ParseError