packages feed

mono-traversable 1.0.6.0 → 1.0.7.0

raw patch · 3 files changed

+38/−5 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Data.Sequences: dropPrefix :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> seq
+ Data.Sequences: dropSuffix :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> seq
- Data.Sequences: sort :: (IsSequence seq, Ord (Element seq)) => seq -> seq
+ Data.Sequences: sort :: (SemiSequence seq, Ord (Element seq)) => seq -> seq

Files

ChangeLog.md view
@@ -1,3 +1,8 @@+## 1.0.7.0++* Add `dropPrefix` and `dropSuffix` to `Data.Sequences` [#139](https://github.com/snoyberg/mono-traversable/issues/139)+* Change `sort` implementation [#153](https://github.com/snoyberg/mono-traversable/issues/153)+ ## 1.0.6.0  * Add `mapNonNull` function to `Data.NonNull` [#150](https://github.com/snoyberg/mono-traversable/issues/150)
mono-traversable.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: bc8a0b9aa12636444123bfbeb72078faed482f924d48c553daf2ced10e993bb6+-- hash: f22319daf40fc1cd315fbeb748296c892ee860915c82dc6ec2407bc44ace929e  name:           mono-traversable-version:        1.0.6.0+version:        1.0.7.0 synopsis:       Type classes for mapping, folding, and traversing monomorphic containers description:    Please see the README at <https://www.stackage.org/package/mono-traversable> category:       Data
src/Data/Sequences.hs view
@@ -8,7 +8,7 @@ -- | Abstractions over sequential data structures, like lists and vectors. module Data.Sequences where -import Data.Maybe (fromJust, isJust)+import Data.Maybe (fromJust, fromMaybe, isJust) import Data.Monoid (Monoid, mconcat, mempty, (<>)) import Data.MonoTraversable import Data.Int (Int64, Int)@@ -1260,6 +1260,34 @@     stripSuffixList :: Eq a => [a] -> [a] -> Maybe [a]     stripSuffixList x' y' = fmap reverse (stripPrefix (reverse x') (reverse y')) +-- | 'dropPrefix' drops the given prefix from a sequence.  It returns the+-- original sequence if the sequence doesn't start with the given prefix.+--+-- @+-- > 'dropPrefix' \"foo\" \"foobar\"+-- \"bar\"+-- > 'dropPrefix' \"abc\" \"foobar\"+-- \"foobar\"+-- @+--+-- @since 1.0.7.0+dropPrefix :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> seq+dropPrefix x y = fromMaybe y (stripPrefix x y)++-- | 'dropSuffix' drops the given suffix from a sequence.  It returns the+-- original sequence if the sequence doesn't end with the given suffix.+--+-- @+-- > 'dropSuffix' \"bar\" \"foobar\"+-- \"foo\"+-- > 'dropSuffix' \"abc\" \"foobar\"+-- \"foobar\"+-- @+--+-- @since 1.0.7.0+dropSuffix :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> seq+dropSuffix x y = fromMaybe y (stripSuffix x y)+ -- | 'ensurePrefix' will add a prefix to a sequence if it doesn't -- exist, and otherwise have no effect. --@@ -1435,8 +1463,8 @@ -- > 'sort' [4,3,1,2] -- [1,2,3,4] -- @-sort :: (IsSequence seq, Ord (Element seq)) => seq -> seq-sort = fromList . V.toList . vectorSort . V.fromList . otoList+sort :: (SemiSequence seq, Ord (Element seq)) => seq -> seq+sort = sortBy compare {-# INLINE [0] sort #-}  {-# RULES "strict ByteString sort" sort = S.sort #-}