Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ binary-0.7.6.0
binary-0.7.5.0
--------------

- Fix performance bug that was noticable when you get a big strict ByteString
- Fix performance bug that was noticeable when you get a big strict ByteString
and the input to the decoder consists of many small chunks.
- https://github.com/kolmodin/binary/issues/73
- https://github.com/kolmodin/binary/pull/76
Expand Down Expand Up @@ -196,7 +196,7 @@ binary-0.6.4
binary-0.6.3
------------

- Documentation tweeks, internal restructuring, more tests.
- Documentation tweaks, internal restructuring, more tests.

binary-0.6.2
------------
Expand Down
8 changes: 4 additions & 4 deletions src/Data/Binary/Get.hs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ import Data.Binary.FloatCast (wordToFloat, wordToDouble)
-- If it succeeds it will return 'Done' with the resulting value,
-- the position and the remaining input.

-- | A decoder procuced by running a 'Get' monad.
-- | A decoder produced by running a 'Get' monad.
data Decoder a = Fail !B.ByteString {-# UNPACK #-} !ByteOffset String
-- ^ The decoder ran into an error. The decoder either used
-- 'fail' or was not provided enough input. Contains any
Expand Down Expand Up @@ -421,7 +421,7 @@ getRemainingLazyByteString :: Get L.ByteString
getRemainingLazyByteString = withInputChunks () consumeAll L.fromChunks resumeOnEOF

------------------------------------------------------------------------
-- Primtives
-- Primitives

-- helper, get a raw Ptr onto a strict ByteString copied out of the
-- underlying lazy byteString.
Expand Down Expand Up @@ -586,7 +586,7 @@ getWord32host :: Get Word32
getWord32host = getPtr (sizeOf (undefined :: Word32))
{-# INLINE getWord32host #-}

-- | /O(1)./ Read a Word64 in native host order and host endianess.
-- | /O(1)./ Read a Word64 in native host order and host endianness.
getWord64host :: Get Word64
getWord64host = getPtr (sizeOf (undefined :: Word64))
{-# INLINE getWord64host #-}
Expand All @@ -607,7 +607,7 @@ getInt32host :: Get Int32
getInt32host = getPtr (sizeOf (undefined :: Int32))
{-# INLINE getInt32host #-}

-- | /O(1)./ Read an Int64 in native host order and host endianess.
-- | /O(1)./ Read an Int64 in native host order and host endianness.
getInt64host :: Get Int64
getInt64host = getPtr (sizeOf (undefined :: Int64))
{-# INLINE getInt64host #-}
Expand Down
6 changes: 3 additions & 3 deletions src/Data/Binary/Get/Internal.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{-# LANGUAGE CPP, RankNTypes, MagicHash, BangPatterns, TypeFamilies #-}

-- CPP C style pre-precessing, the #if defined lines
-- CPP C style pre-processing, the #if defined lines
-- RankNTypes forall r. statement
-- MagicHash the (# unboxing #), also needs GHC.primitives

Expand Down Expand Up @@ -56,7 +56,7 @@ import Data.Binary.Internal ( accursedUnutterablePerformIO )

-- Kolmodin 20100427: at zurihac we discussed of having partial take a
-- "Maybe ByteString" and implemented it in this way.
-- The reasoning was that you could accidently provide an empty bytestring,
-- The reasoning was that you could accidentally provide an empty bytestring,
-- and it should not terminate the decoding (empty would mean eof).
-- However, I'd say that it's also a risk that you get stuck in a loop,
-- where you keep providing an empty string. Anyway, no new input should be
Expand All @@ -76,7 +76,7 @@ data Decoder a = Fail !B.ByteString String
-- output value you also get the unused input.
| BytesRead {-# UNPACK #-} !Int64 (Int64 -> Decoder a)
-- ^ The decoder needs to know the current position in the input.
-- Given the number of bytes remaning in the decoder, the outer
-- Given the number of bytes remaining in the decoder, the outer
-- decoder runner needs to calculate the position and
-- resume the decoding.

Expand Down
6 changes: 3 additions & 3 deletions tests/Action.hs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ prop_fail =
" but got " ++ show off)
| inp /= L.drop (fromIntegral off) lbs ->
error $ "remaining output incorrect, was: " ++ show inp ++
", should hav been: " ++ show (L.drop (fromIntegral off) lbs)
", should have been: " ++ show (L.drop (fromIntegral off) lbs)
| otherwise -> property True
Right (_inp, _off, _value) -> label "test case without 'fail'" $ property True

Expand All @@ -197,7 +197,7 @@ failReason _ = "NoFail"

-- | The result of an evaluation.
data Eval = ESuccess Int
-- ^ The evalutation completed successfully. Contains the number of
-- ^ The evaluation completed successfully. Contains the number of
-- remaining bytes of the input.
| EFail FailReason [String] Int
-- ^ The evaluation completed with a failure. Contains the labels up
Expand All @@ -212,7 +212,7 @@ data FailReason
deriving (Show,Eq)

-- | Given the number of input bytes and a list of actions, evaluate the
-- actions and return whether the actions succeeed or fail.
-- actions and return whether the actions succeed or fail.
eval :: Int -> [Action] -> Eval
eval inp0 = go inp0 []
where
Expand Down
2 changes: 1 addition & 1 deletion tests/QC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ prop_bytesRead lbs =
-- | We're trying to guarantee that the Decoder will not ask for more input
-- with Partial if it has been given Nothing once.
-- In this test we're making the decoder return 'Partial' to get more
-- input, and to get knownledge of the current position using 'BytesRead'.
-- input, and to get knowledge of the current position using 'BytesRead'.
-- Both of these operations, when used with the <|> operator, result internally
-- in that the decoder return with Partial and BytesRead multiple times,
-- in which case we need to keep track of if the user has passed Nothing to a
Expand Down