-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Binary deserialisation using strict ByteStrings -- -- This is a strict version of the Get monad from the binary package. -- Ti's pretty much just a copy and paste job from the original source -- code. The binary team are currently unsure about their future plans -- w.r.t. strictness, so this is just a stop gap measure. @package binary-strict @version 0.1 -- | This is a strict version of the Get monad from the binary package. -- It's pretty much just a copy and paste job from the original source -- code. The binary team are currently unsure about their future plans -- w.r.t. strictness, so this is a stop gap measure. -- -- To use, write a function in the Get monad: -- --
--   import Data.Binary.Strict.Get as BinStrict
--   import Data.ByteString as BS
--   parse :: BinStrict.Get
--   parse = getWord16be
--   main = print $ runGet parse $ BS.pack [1, 1]
--   
-- -- This results in a tuple of (Right 257, "") (where the second element -- is just the remaining data after the parser has run) module Data.Binary.Strict.Get data Get a -- | Run a parser on the given input and return the result (either an error -- string from a call to fail, or the parsing result) and the -- remainder of of the input. runGet :: Get a -> ByteString -> (Either String a, ByteString) -- | Run ga, but return without consuming its input. Fails if -- ga fails. lookAhead :: Get a -> Get a -- | Like lookAhead, but consume the input if gma returns -- 'Just _'. Fails if gma fails. lookAheadM :: Get (Maybe a) -> Get (Maybe a) -- | Like lookAhead, but consume the input if gea returns -- 'Right _'. Fails if gea fails. lookAheadE :: Get (Either a b) -> Get (Either a b) -- | Skip ahead n bytes. Fails if fewer than n bytes are -- available. skip :: Int -> Get () -- | Get the total number of bytes read to this point. bytesRead :: Get Int -- | Get the number of remaining unparsed bytes. Useful for checking -- whether all input has been consumed. remaining :: Get Int -- | Test whether all input has been consumed, i.e. there are no remaining -- unparsed bytes. isEmpty :: Get Bool getWord8 :: Get Word8 -- | An efficient get method for strict ByteStrings. Fails if fewer -- than n bytes are left in the input. getByteString :: Int -> Get ByteString -- | Read a Word16 in big endian format getWord16be :: Get Word16 -- | Read a Word32 in big endian format getWord32be :: Get Word32 -- | Read a Word64 in big endian format getWord64be :: Get Word64 -- | Read a Word16 in little endian format getWord16le :: Get Word16 -- | Read a Word32 in little endian format getWord32le :: Get Word32 -- | Read a Word64 in little endian format getWord64le :: Get Word64 -- | O(1). Read a single native machine word. The word is read in -- host order, host endian form, for the machine you're on. On a 64 bit -- machine the Word is an 8 byte value, on a 32 bit machine, 4 bytes. getWordhost :: Get Word -- | O(1). Read a 2 byte Word16 in native host order and host -- endianness. getWord16host :: Get Word16 -- | O(1). Read a Word32 in native host order and host endianness. getWord32host :: Get Word32 -- | O(1). Read a Word64 in native host order and host endianess. getWord64host :: Get Word64 instance Monad Get instance Functor Get