Skip to content

Commit ea0d6a3

Browse files
authored
Fix typos (#719)
1 parent da6f41a commit ea0d6a3

File tree

12 files changed

+30
-30
lines changed

12 files changed

+30
-30
lines changed

Changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
* Performance improvements:
169169
* [Many functions returning `StrictByteString` can now return their results unboxed](https://github.com/haskell/bytestring/pull/580)
170170
* [Dead branches removed from `Lazy.toStrict`](https://github.com/haskell/bytestring/pull/590)
171-
* [`Builder.toLazyByteString` re-uses under-filled buffers after copying their contents](https://github.com/haskell/bytestring/pull/581)
171+
* [`Builder.toLazyByteString` reuses under-filled buffers after copying their contents](https://github.com/haskell/bytestring/pull/581)
172172
* Miscellaneous:
173173
* [Minor benchmarking improvements](https://github.com/haskell/bytestring/pull/577)
174174
<!--

Data/ByteString.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1723,7 +1723,7 @@ tailsNE :: ByteString -> NonEmpty ByteString
17231723
tailsNE p | null p = empty :| []
17241724
| otherwise = p :| tails (unsafeTail p)
17251725

1726-
-- less efficent spacewise: tails (BS x l) = [BS (plusForeignPtr x n) (l-n) | n <- [0..l]]
1726+
-- less efficient spacewise: tails (BS x l) = [BS (plusForeignPtr x n) (l-n) | n <- [0..l]]
17271727

17281728
{-
17291729
Note [Avoid NonEmpty combinators]

Data/ByteString/Builder.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ For an /efficient implementation of an encoding/,
2424
the Haskell values to the resulting sequence of bytes /and/
2525
(b) that the representation of the resulting sequence
2626
is such that it can be consumed efficiently.
27-
'Builder's support (a) by providing an /O(1)/ concatentation operation
27+
'Builder's support (a) by providing an /O(1)/ concatenation operation
2828
and efficient implementations of basic encodings for 'Char's, 'Int's,
2929
and other standard Haskell values.
3030
They support (b) by providing their result as a 'L.LazyByteString',
@@ -148,7 +148,7 @@ For example,
148148
>renderRow :: Row -> Builder
149149
>renderRow = mconcat . intersperse (charUtf8 ',') . map renderCell
150150
151-
Similarly, using /O(n)/ concatentations like '++' or the equivalent 'Data.ByteString.concat'
151+
Similarly, using /O(n)/ concatenations like '++' or the equivalent 'Data.ByteString.concat'
152152
operations on strict and 'L.LazyByteString's should be avoided.
153153
The following definition of @renderString@ is also about 20% slower.
154154

Data/ByteString/Builder/Internal.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ wrappedBufferRangeCopyStep (BufferRange ip0 ipe) k =
869869

870870

871871
-- | Construct a 'Builder' that copies the 'S.StrictByteString's, if it is
872-
-- smaller than the treshold, and inserts it directly otherwise.
872+
-- smaller than the threshold, and inserts it directly otherwise.
873873
--
874874
-- For example, @byteStringThreshold 1024@ copies 'S.StrictByteString's whose size
875875
-- is less or equal to 1kb, and inserts them directly otherwise. This implies
@@ -1017,7 +1017,7 @@ modUtf8_step !ip !len k (BufferRange op ope)
10171017
!usable = avail `min` len
10181018
-- null-termination makes it possible to read one more byte than the
10191019
-- nominal input length, with any unexpected 0xC000 ending interpreted
1020-
-- as a NUL. More typically, this simplifies hanlding of inputs where
1020+
-- as a NUL. More typically, this simplifies handling of inputs where
10211021
-- 0xC0 0x80 might otherwise be split across the "usable" input window.
10221022
!ch <- peekElemOff ip (usable - 1)
10231023
let !use | ch /= 0xC0 = usable
@@ -1308,15 +1308,15 @@ buildStepToCIOS (AllocationStrategy nextBuffer bufSize trim) =
13081308
else do buf' <- nextBuffer (Just (buf, bufSize))
13091309
fill nextStep buf'
13101310

1311-
-- Wrap and yield a chunk, trimming it if necesary
1311+
-- Wrap and yield a chunk, trimming it if necessary
13121312
{-# INLINE wrapChunk #-}
13131313
wrapChunk :: Ptr Word8 -> (Bool -> IO (ChunkIOStream a)) -> IO (ChunkIOStream a)
13141314
wrapChunk !op' mkCIOS
13151315
| chunkSize == 0 = mkCIOS True
13161316
| trim chunkSize size = do
13171317
bs <- S.createFp chunkSize $ \fpbuf' ->
13181318
S.memcpyFp fpbuf' fpbuf chunkSize
1319-
-- It is not safe to re-use the old buffer (see #690),
1319+
-- It is not safe to reuse the old buffer (see #690),
13201320
-- so we allocate a new buffer after trimming.
13211321
return $ Yield1 bs (mkCIOS False)
13221322
| otherwise =

Data/ByteString/Builder/Prim.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ primMapLazyByteStringFixed = primMapLazyByteStringBounded . toB
520520
--
521521
-- > primBounded (word32 c1) `mappend` primBounded (word32 c2)
522522
--
523-
-- is rewritten such that the resulting 'Builder' checks only once, if ther are
523+
-- is rewritten such that the resulting 'Builder' checks only once, if there are
524524
-- at 8 free bytes, instead of checking twice, if there are 4 free bytes. This
525525
-- optimization is not observationally equivalent in a strict sense, as it
526526
-- influences the boundaries of the generated chunks. However, for a user of

Data/ByteString/Internal/Pure.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ encodeUnsignedHex :: (Eq a, Num a, Integral a, Bits a) => a -> Ptr Word8 -> IO (
348348
{-# INLINABLE encodeUnsignedHex #-} -- for specialization
349349
encodeUnsignedHex !v !next_ptr = encodeUnsignedHex' v next_ptr next_ptr
350350

351-
-- | Encode positive number as little-endian hexdecimal, then reverse it.
351+
-- | Encode positive number as little-endian hexadecimal, then reverse it.
352352
--
353353
-- Take two pointers (orig_ptr, next_ptr) to support already encoded digits
354354
encodeUnsignedHex' :: (Eq a, Num a, Integral a, Bits a) => a -> Ptr Word8 -> Ptr Word8 -> IO (Ptr Word8)

Data/ByteString/Internal/Type.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -690,27 +690,27 @@ unpackAppendCharsLazy (BS fp len) cs
690690
-- For these unpack functions, since we're unpacking the whole list strictly we
691691
-- build up the result list in an accumulator. This means we have to build up
692692
-- the list starting at the end. So our traversal starts at the end of the
693-
-- buffer and loops down until we hit the sentinal:
693+
-- buffer and loops down until we hit the sentinel:
694694

695695
unpackAppendBytesStrict :: ByteString -> [Word8] -> [Word8]
696696
unpackAppendBytesStrict (BS fp len) xs =
697697
accursedUnutterablePerformIO $ unsafeWithForeignPtr fp $ \base ->
698698
loop (base `plusPtr` (-1)) (base `plusPtr` (-1+len)) xs
699699
where
700-
loop !sentinal !p acc
701-
| p == sentinal = return acc
700+
loop !sentinel !p acc
701+
| p == sentinel = return acc
702702
| otherwise = do x <- peek p
703-
loop sentinal (p `plusPtr` (-1)) (x:acc)
703+
loop sentinel (p `plusPtr` (-1)) (x:acc)
704704

705705
unpackAppendCharsStrict :: ByteString -> [Char] -> [Char]
706706
unpackAppendCharsStrict (BS fp len) xs =
707707
accursedUnutterablePerformIO $ unsafeWithForeignPtr fp $ \base ->
708708
loop (base `plusPtr` (-1)) (base `plusPtr` (-1+len)) xs
709709
where
710-
loop !sentinal !p acc
711-
| p == sentinal = return acc
710+
loop !sentinel !p acc
711+
| p == sentinel = return acc
712712
| otherwise = do x <- peek p
713-
loop sentinal (p `plusPtr` (-1)) (w2c x:acc)
713+
loop sentinel (p `plusPtr` (-1)) (w2c x:acc)
714714

715715
------------------------------------------------------------------------
716716

Data/ByteString/Lazy.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ cons c = Chunk (S.singleton c)
327327
-- may coalesce the new byte onto the first \'chunk\' rather than starting a
328328
-- new \'chunk\'.
329329
--
330-
-- So that means you can't use a lazy recursive contruction like this:
330+
-- So that means you can't use a lazy recursive construction like this:
331331
--
332332
-- > let xs = cons' c xs in xs
333333
--
@@ -1522,7 +1522,7 @@ tailsNE bs = case uncons bs of
15221522
-- is needed in the rest of the program.
15231523
copy :: ByteString -> ByteString
15241524
copy = foldrChunks (Chunk . S.copy) Empty
1525-
--TODO, we could coalese small blocks here
1525+
--TODO, we could coalesce small blocks here
15261526
--FIXME: probably not strict enough, if we're doing this to avoid retaining
15271527
-- the parent blocks then we'd better copy strictly.
15281528

Data/ByteString/Lazy/Char8.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ cons = L.cons . c2w
294294
-- may coalesce the new byte onto the first \'chunk\' rather than starting a
295295
-- new \'chunk\'.
296296
--
297-
-- So that means you can't use a lazy recursive contruction like this:
297+
-- So that means you can't use a lazy recursive construction like this:
298298
--
299299
-- > let xs = cons' c xs in xs
300300
--
@@ -893,7 +893,7 @@ lines (Chunk c0 cs0) = unNE $! go c0 cs0
893893
-- In particular, we don't strictly pattern match on 'cs'.
894894
--
895895
-- We can form `Chunk c ...` because the invariant is maintained
896-
-- here and also by using `chunk` in the defintion of `c'` above.
896+
-- here and also by using `chunk` in the definition of `c'` above.
897897
Nothing -> let ~(l:|ls) = lazyRest cs
898898
in Chunk c l :| ls
899899
where

Data/ByteString/Lazy/ReadInt.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ _readDecimal !r = consume
217217
-- accumulator would overflow return 'Overflow'.
218218
--
219219
_digits :: Word64 -- ^ maximum non-overflow value `div` 10
220-
-> Word64 -- ^ maximum non-overflow vavlue `mod` 10
220+
-> Word64 -- ^ maximum non-overflow value `mod` 10
221221
-> ForeignPtr Word8 -- ^ Input buffer
222222
-> Int -- ^ Input length
223223
-> Word64 -- ^ Accumulated value of leading digits

0 commit comments

Comments
 (0)