diff --git a/Changelog.md b/Changelog.md index 3ce85f350..e708fb61e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -9,7 +9,7 @@ * [Add `IsList` instances for strict and lazy `ByteString` and for `ShortByteString`](https://github.com/haskell/bytestring/pull/219) * [Add `createUpToN'` and `unsafeCreateUpToN'` to `Data.ByteString.Internal`](https://github.com/haskell/bytestring/pull/245) * [Add `boundedPrim` to `Data.ByteString.Builder.Prim.Internal` and deprecate `boudedPrim`](https://github.com/haskell/bytestring/pull/246) - * Add `indexMaybe` for indexing that returns `Maybe` + * Add `indexMaybe` and synonym `(!?)` for indexing that returns `Maybe` * [Deprecate the `Data.ByteString.Lazy.Builder` and `Data.ByteString.Lazy.Builder.{ASCII,Extras}` modules](https://github.com/haskell/bytestring/pull/250) * [Fix documented complexity of `Data.ByteString.Lazy.length`](https://github.com/haskell/bytestring/pull/255) * [Assorted documentation fixes](https://github.com/haskell/bytestring/pull/248) diff --git a/Data/ByteString.hs b/Data/ByteString.hs index a6c1b8bfb..0d24be2ea 100644 --- a/Data/ByteString.hs +++ b/Data/ByteString.hs @@ -1103,7 +1103,7 @@ index ps n -- -- > 0 <= n < length bs -- --- @since 0.10.10.0 +-- @since 0.10.10.1 indexMaybe :: ByteString -> Int -> Maybe Word8 indexMaybe ps n | n < 0 = Nothing @@ -1115,7 +1115,7 @@ indexMaybe ps n -- -- > 0 <= n < length bs -- --- @since 0.10.10.0 +-- @since 0.10.10.1 (!?) :: ByteString -> Int -> Maybe Word8 (!?) = indexMaybe {-# INLINE (!?) #-} diff --git a/Data/ByteString/Char8.hs b/Data/ByteString/Char8.hs index 466468c11..2dd3d4eca 100644 --- a/Data/ByteString/Char8.hs +++ b/Data/ByteString/Char8.hs @@ -650,7 +650,7 @@ index = (w2c .) . B.index -- -- > 0 <= n < length bs -- --- @since 0.10.10.0 +-- @since 0.10.10.1 indexMaybe :: ByteString -> Int -> Maybe Char indexMaybe = ((fmap w2c) .) . B.indexMaybe {-# INLINE indexMaybe #-} @@ -659,7 +659,7 @@ indexMaybe = ((fmap w2c) .) . B.indexMaybe -- -- > 0 <= n < length bs -- --- @since 0.10.10.0 +-- @since 0.10.10.1 (!?) :: ByteString -> Int -> Maybe Char (!?) = indexMaybe {-# INLINE (!?) #-} diff --git a/Data/ByteString/Lazy.hs b/Data/ByteString/Lazy.hs index a434820a9..d5d62df90 100644 --- a/Data/ByteString/Lazy.hs +++ b/Data/ByteString/Lazy.hs @@ -901,7 +901,7 @@ index cs0 i = index' cs0 i -- -- > 0 <= n < length bs -- --- @since 0.10.10.0 +-- @since 0.10.10.1 indexMaybe :: ByteString -> Int64 -> Maybe Word8 indexMaybe _ i | i < 0 = Nothing indexMaybe cs0 i = index' cs0 i @@ -915,7 +915,7 @@ indexMaybe cs0 i = index' cs0 i -- -- > 0 <= n < length bs -- --- @since 0.10.10.0 +-- @since 0.10.10.1 (!?) :: ByteString -> Int64 -> Maybe Word8 (!?) = indexMaybe {-# INLINE (!?) #-} diff --git a/Data/ByteString/Lazy/Char8.hs b/Data/ByteString/Lazy/Char8.hs index a41a3902d..48f668ebe 100644 --- a/Data/ByteString/Lazy/Char8.hs +++ b/Data/ByteString/Lazy/Char8.hs @@ -533,7 +533,7 @@ index = (w2c .) . L.index -- -- > 0 <= n < length bs -- --- @since 0.10.10.0 +-- @since 0.10.10.1 indexMaybe :: ByteString -> Int64 -> Maybe Char indexMaybe = ((fmap w2c) .) . L.indexMaybe {-# INLINE indexMaybe #-} @@ -542,7 +542,7 @@ indexMaybe = ((fmap w2c) .) . L.indexMaybe -- -- > 0 <= n < length bs -- --- @since 0.10.10.0 +-- @since 0.10.10.1 (!?) :: ByteString -> Int64 -> Maybe Char (!?) = indexMaybe {-# INLINE (!?) #-} diff --git a/Data/ByteString/Short/Internal.hs b/Data/ByteString/Short/Internal.hs index 20ea5b4cb..46d2b6443 100644 --- a/Data/ByteString/Short/Internal.hs +++ b/Data/ByteString/Short/Internal.hs @@ -220,7 +220,7 @@ index sbs i -- -- > 0 <= n < length bs -- --- @since 0.10.10.0 +-- @since 0.10.10.1 indexMaybe :: ShortByteString -> Int -> Maybe Word8 indexMaybe sbs i | i >= 0 && i < length sbs = Just $ unsafeIndex sbs i @@ -230,7 +230,7 @@ indexMaybe sbs i -- -- > 0 <= n < length bs -- --- @since 0.10.10.0 +-- @since 0.10.10.1 (!?) :: ShortByteString -> Int -> Maybe Word8 (!?) = indexMaybe