Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add StrictByteString & LazyByteString type aliases #378

Merged
merged 1 commit into from
Mar 19, 2021
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ ghc.mk
cabal.sandbox.config
.hsenv
*~
dist-newstyle/
3 changes: 2 additions & 1 deletion Data/ByteString.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@

module Data.ByteString (

-- * The @ByteString@ type
-- * Strict @ByteString@
ByteString,
StrictByteString,

-- * Introducing and eliminating 'ByteString's
empty,
Expand Down
4 changes: 4 additions & 0 deletions Data/ByteString/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ module Data.ByteString.Internal (
, PS -- backwards compatibility shim
),

StrictByteString,

-- * Internal indexing
findIndexOrLength,

Expand Down Expand Up @@ -201,6 +203,8 @@ data ByteString = BS {-# UNPACK #-} !(ForeignPtr Word8) -- payload
-- ^ @since 0.11.0.0
deriving (Typeable)

-- | Type synonym for the strict flavour of 'ByteString'.
type StrictByteString = ByteString

-- |
-- @'PS' foreignPtr offset length@ represents a 'ByteString' with data
Expand Down
3 changes: 2 additions & 1 deletion Data/ByteString/Lazy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@

module Data.ByteString.Lazy (

-- * The @ByteString@ type
-- * Lazy @ByteString@
ByteString,
LazyByteString,

-- * Introducing and eliminating 'ByteString's
empty,
Expand Down
4 changes: 4 additions & 0 deletions Data/ByteString/Lazy/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module Data.ByteString.Lazy.Internal (

-- * The lazy @ByteString@ type and representation
ByteString(..),
LazyByteString,
chunk,
foldrChunks,
foldlChunks,
Expand Down Expand Up @@ -80,6 +81,9 @@ data ByteString = Empty | Chunk {-# UNPACK #-} !S.ByteString ByteString
deriving (Typeable)
-- See 'invariant' function later in this module for internal invariants.

-- | Type synonym for the lazy flavour of 'ByteString'.
type LazyByteString = ByteString

instance Eq ByteString where
(==) = eq

Expand Down