Skip to content

Commit

Permalink
doc: Fix haddocks in Data.ByteString.Short (#654)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lysxia authored Feb 2, 2024
1 parent 93fdd3a commit e456ea1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Data/ByteString/Short.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ module Data.ByteString.Short (
-- | With GHC, the memory overheads are as follows, expressed in words and
-- in bytes (words are 4 and 8 bytes on 32 or 64bit machines respectively).
--
-- * 'B.ByteString' unshared: 8 words; 32 or 64 bytes.
-- * t'Data.ByteString.ByteString' unshared: 8 words; 32 or 64 bytes.
--
-- * 'B.ByteString' shared substring: 4 words; 16 or 32 bytes.
-- * t'Data.ByteString.ByteString' shared substring: 4 words; 16 or 32 bytes.
--
-- * 'ShortByteString': 4 words; 16 or 32 bytes.
--
-- For the string data itself, both 'ShortByteString' and 'B.ByteString' use
-- For the string data itself, both 'ShortByteString' and t'Data.ByteString.ByteString' use
-- one byte per element, rounded up to the nearest word. For example,
-- including the overheads, a length 10 'ShortByteString' would take
-- @16 + 12 = 28@ bytes on a 32bit platform and @32 + 16 = 48@ bytes on a
-- 64bit platform.
--
-- These overheads can all be reduced by 1 word (4 or 8 bytes) when the
-- 'ShortByteString' or 'B.ByteString' is unpacked into another constructor.
-- 'ShortByteString' or t'Data.ByteString.ByteString' is unpacked into another constructor.
--
-- For example:
--
Expand All @@ -58,7 +58,7 @@ module Data.ByteString.Short (
-- string data.

-- ** Heap fragmentation
-- | With GHC, the 'B.ByteString' representation uses /pinned/ memory,
-- | With GHC, the t'Data.ByteString.ByteString' representation uses /pinned/ memory,
-- meaning it cannot be moved by the GC. This is usually the right thing to
-- do for larger strings, but for small strings using pinned memory can
-- lead to heap fragmentation which wastes space. The 'ShortByteString'
Expand Down
1 change: 1 addition & 0 deletions Data/ByteString/Short/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,7 @@ isInfixOf :: ShortByteString -> ShortByteString -> Bool
isInfixOf sbs = \s -> null sbs || not (null $ snd $ (GHC.Exts.inline breakSubstring) sbs s)

-- |/O(n)/ The 'isPrefixOf' function takes two ShortByteStrings and returns 'True'
-- iff the first is a prefix of the second.
--
-- @since 0.11.3.0
isPrefixOf :: ShortByteString -> ShortByteString -> Bool
Expand Down

0 comments on commit e456ea1

Please sign in to comment.