Skip to content

Commit

Permalink
Merge shortbytestring package back into bytestring wrt haskell#444
Browse files Browse the repository at this point in the history
  • Loading branch information
hasufell committed Jan 22, 2022
1 parent 5efd6b5 commit 2125e9d
Show file tree
Hide file tree
Showing 6 changed files with 1,502 additions and 29 deletions.
10 changes: 9 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@
* [`readInt` returns `Nothing`, if the sequence of digits cannot be represented by an `Int`, instead of overflowing silently](https://github.com/haskell/bytestring/pull/309)
* [Remove `zipWith` rewrite rule](https://github.com/haskell/bytestring/pull/387)

[0.12.0.0]: https://github.com/haskell/bytestring/compare/0.11.2.0...0.12.0.0
[0.12.0.0]: https://github.com/haskell/bytestring/compare/0.11.3.0...0.12.0.0

[0.11.3.0] — Unreleased

* merge `shortbytestring` package back into `bytestring` wrt [#444](https://github.com/haskell/bytestring/issues/444),
adding lots of additional API:
- [Add `all`, `any`, `append`, `break`, `breakEnd`, `breakSubstring`, `concat`, `cons`, `count`, `drop`, `dropEnd`, `dropWhile`, `dropWhileEnd`, `elem`, `elemIndex`, `elemIndices`, `filter`, `find`, `findIndex`, `findIndices`, `foldl'`, `foldl`, `foldl1'`, `foldl1`, `foldr'`, `foldr`, `foldr1'`, `foldr1`, `head`, `init`, `intercalate`, `isInfixOf`, `isPrefixOf`, `isSuffixOf`, `last`, `map`, `partition`, `replicate`, `reverse`, `singleton`, `snoc`, `span`, `spanEnd`, `split`, `splitAt`, `splitWith`, `stripPrefix`, `stripSuffix`, `tail`, `take`, `takeEnd`, `takeWhile`, `takeWhileEnd`, `unfoldr`, `unfoldrN`](https://github.com/haskell/bytestring/pull/471)

[0.11.3.0]: https://github.com/haskell/bytestring/compare/0.11.2.0...0.11.3.0

[0.11.2.0] — December 2021

Expand Down
107 changes: 96 additions & 11 deletions Data/ByteString/Short.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

-- |
-- Module : Data.ByteString.Short
-- Copyright : (c) Duncan Coutts 2012-2013
-- Copyright : (c) Duncan Coutts 2012-2013, Julian Ospald 2022
-- License : BSD-style
--
-- Maintainer : [email protected]
-- Maintainer : [email protected]
-- Stability : stable
-- Portability : ghc only
--
Expand Down Expand Up @@ -67,26 +67,111 @@ module Data.ByteString.Short (
-- small unpinned strings are allocated in the same way as normal heap
-- allocations, rather than in a separate pinned area.

-- * Conversions
toShort,
fromShort,
-- * Introducing and eliminating 'ShortByteString's
empty,
singleton,
pack,
unpack,
fromShort,
toShort,

-- * Other operations
empty, null, length, index, indexMaybe, (!?),
-- * Basic interface
snoc,
cons,
append,
last,
tail,
head,
init,
null,
length,

-- ** Encoding validation
-- * Encoding validation
isValidUtf8,

-- * Transforming ShortByteStrings
map,
reverse,
intercalate,

-- * Reducing 'ShortByteString's (folds)
foldl,
foldl',
foldl1,
foldl1',

foldr,
foldr',
foldr1,
foldr1',

-- ** Special folds
all,
any,
concat,

-- ** Generating and unfolding ByteStrings
replicate,
unfoldr,
unfoldrN,

-- * Substrings

-- ** Breaking strings
take,
takeEnd,
takeWhileEnd,
takeWhile,
drop,
dropEnd,
dropWhile,
dropWhileEnd,
breakEnd,
break,
span,
spanEnd,
splitAt,
split,
splitWith,
stripSuffix,
stripPrefix,

-- * Predicates
isInfixOf,
isPrefixOf,
isSuffixOf,

-- ** Search for arbitrary substrings
breakSubstring,

-- * Searching ShortByteStrings

-- ** Searching by equality
elem,

-- ** Searching with a predicate
find,
filter,
partition,

-- * Indexing ShortByteStrings
index,
indexMaybe,
(!?),
elemIndex,
elemIndices,
count,
findIndex,
findIndices,

-- * Low level conversions
-- ** Packing 'Foreign.C.String.CString's and pointers
-- ** Packing 'CString's and pointers
packCString,
packCStringLen,

-- ** Using ByteStrings as 'Foreign.C.String.CString's
-- ** Using ShortByteStrings as 'CString's
useAsCString,
useAsCStringLen
useAsCStringLen,
) where

import Data.ByteString.Short.Internal
Expand Down
Loading

0 comments on commit 2125e9d

Please sign in to comment.