-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A highly-efficient but limited parser API specialised for bytestrings
--   
--   A highly-efficient but limited parser API specialised for bytestrings
@package binary-parser
@version 0.5.5

module BinaryParser

-- | A highly-efficient parser specialised for strict <a>ByteString</a>s.
--   
--   Supports the roll-back and alternative branching on the basis of the
--   <a>Alternative</a> interface.
--   
--   Does not generate fancy error-messages, which contributes to its
--   efficiency.
data BinaryParser a

-- | Apply a parser to bytes.
run :: BinaryParser a -> ByteString -> Either Text a

-- | Fail with a message.
failure :: Text -> BinaryParser a

-- | Consume a single byte.
byte :: BinaryParser Word8

-- | Consume a single byte, which satisfies the predicate.
matchingByte :: (Word8 -> Either Text a) -> BinaryParser a

-- | Consume an amount of bytes.
bytesOfSize :: Int -> BinaryParser ByteString

-- | Consume multiple bytes, which satisfy the predicate.
bytesWhile :: (Word8 -> Bool) -> BinaryParser ByteString

-- | Skip an amount of bytes.
unitOfSize :: Int -> BinaryParser ()

-- | Skip specific bytes, while failing if they don't match.
unitOfBytes :: ByteString -> BinaryParser ()

-- | Skip bytes, which satisfy the predicate.
unitWhile :: (Word8 -> Bool) -> BinaryParser ()

-- | Consume all the remaining bytes.
remainders :: BinaryParser ByteString

-- | Left-fold the bytes, terminating before the byte, on which the step
--   function returns Nothing.
fold :: (a -> Word8 -> Maybe a) -> a -> BinaryParser a

-- | Fail if the input hasn't ended.
endOfInput :: BinaryParser ()

-- | Run a subparser passing it a chunk of the current input of the
--   specified size.
sized :: Int -> BinaryParser a -> BinaryParser a

-- | Storable value of the given amount of bytes.
storableOfSize :: Storable a => Int -> BinaryParser a

-- | Big-endian word of 2 bytes.
beWord16 :: BinaryParser Word16

-- | Little-endian word of 2 bytes.
leWord16 :: BinaryParser Word16

-- | Big-endian word of 4 bytes.
beWord32 :: BinaryParser Word32

-- | Little-endian word of 4 bytes.
leWord32 :: BinaryParser Word32

-- | Big-endian word of 8 bytes.
beWord64 :: BinaryParser Word64

-- | Little-endian word of 8 bytes.
leWord64 :: BinaryParser Word64

-- | Integral number encoded in ASCII.
asciiIntegral :: Integral a => BinaryParser a
instance Control.Monad.Error.Class.MonadError Data.Text.Internal.Text BinaryParser.BinaryParser
instance GHC.Base.MonadPlus BinaryParser.BinaryParser
instance GHC.Base.Monad BinaryParser.BinaryParser
instance GHC.Base.Alternative BinaryParser.BinaryParser
instance GHC.Base.Applicative BinaryParser.BinaryParser
instance GHC.Base.Functor BinaryParser.BinaryParser
