From a95dd0e3198071d7bdb0bda6bb4054f153135e84 Mon Sep 17 00:00:00 2001 From: Veronika Romashkina Date: Thu, 18 Mar 2021 13:21:35 +0000 Subject: [PATCH] Prepare 0.2.0.0 release --- CHANGELOG.md | 2 +- slist.cabal | 2 +- src/Slist.hs | 18 ++++++++++-------- src/Slist/Containers.hs | 10 +++++----- src/Slist/Maybe.hs | 12 ++++++------ 5 files changed, 23 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76aa15d..358805e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ `slist` uses [PVP Versioning][1]. The changelog is available [on GitHub][2]. -## Unreleased +## 0.2.0.0 — Mar 18, 2021 * [#45](https://github.com/kowainik/slist/issues/45): Support GHC-9.0. Update older GHC's bounds. diff --git a/slist.cabal b/slist.cabal index d4b1acd..0335cca 100644 --- a/slist.cabal +++ b/slist.cabal @@ -1,6 +1,6 @@ cabal-version: 2.4 name: slist -version: 0.1.1.0 +version: 0.2.0.0 synopsis: Sized list description: This package implements @Slist@ data structure that stores the size of the list along with the list itself. diff --git a/src/Slist.hs b/src/Slist.hs index fc156eb..d3007e5 100644 --- a/src/Slist.hs +++ b/src/Slist.hs @@ -481,7 +481,7 @@ init sl@Slist{..} = case sSize of {- | Strict version of the 'Slist' appending operator '<>'. -@since x.x.x.x +@since 0.2.0.0 -} append' :: Slist a -> Slist a -> Slist a append' sl1 sl2 @@ -510,6 +510,8 @@ Slist {sList = "ab", sSize = Size 2} >> __cons' 0 $ 'infiniteSlist' [1..]__ Slist {sList = [0..], sSize = 'Infinity'} @ + +@since 0.2.0.0 -} cons' :: a -> Slist a -> Slist a cons' x (Slist xs !s) = let !newSize = s + 1 in Slist (x:xs) newSize @@ -708,7 +710,7 @@ Slist {sList = [1,2,3,4,5,6,7,8,9,10], sSize = Size 10} Slist {sList = [1..], sSize = 'Infinity'} @ -@since x.x.x.x +@since 0.2.0.0 -} concat' :: Foldable t => t (Slist a) -> Slist a concat' = foldl' append' mempty @@ -732,7 +734,7 @@ Strict version of 'concatMap'. >>> concatMap' one "abc" Slist {sList = "abc", sSize = Size 3} -@since x.x.x.x +@since 0.2.0.0 -} concatMap' :: Foldable t => (a -> Slist b) -> t a -> Slist b concatMap' f = foldl' (\acc x -> acc `append'` f x) mempty @@ -1029,7 +1031,7 @@ Slist {sList = [Slist {sList = [1,2,3], sSize = Size 3}], sSize = Size 1} >>> take 2 $ chunksOf 3 $ infiniteSlist [1..] Slist {sList = [Slist {sList = [1,2,3], sSize = Size 3},Slist {sList = [4,5,6], sSize = Size 3}], sSize = Size 2} -@since x.x.x.x +@since 0.2.0.0 -} chunksOf :: Int -> Slist a -> Slist (Slist a) chunksOf i sl@Slist{..} @@ -1061,7 +1063,7 @@ input. >>> P.take 2 $ listChunksOf 3 [1..] [[1,2,3],[4,5,6]] -@since x.x.x.x +@since 0.2.0.0 -} listChunksOf :: Int -> [a] -> [[a]] listChunksOf i l @@ -1410,7 +1412,7 @@ Returns the pair of slists of elements resulting to 'Left' and resulting to >>> partitionWith onEven $ slist [1..5] (Slist {sList = ["Oops: 1","Oops: 3","Oops: 5"], sSize = Size 3},Slist {sList = [2,4], sSize = Size 2}) -@since x.x.x.x +@since 0.2.0.0 -} partitionWith :: forall a b c . (a -> Either b c) -> Slist a -> (Slist b, Slist c) partitionWith f (Slist l Infinity) = bimap infiniteSlist infiniteSlist $ listPartitionWith f l @@ -1433,7 +1435,7 @@ Returns the pair of lists of elements resulting to 'Left' and resulting to >>> listPartitionWith onEven [1..5] (["Oops: 1","Oops: 3","Oops: 5"],[2,4]) -@since x.x.x.x +@since 0.2.0.0 -} listPartitionWith :: forall a b c . (a -> Either b c) -> [a] -> ([b], [c]) listPartitionWith f = partitionEithers . L.map f @@ -1886,7 +1888,7 @@ the order they appeared in the input. >>> sortWith fst $ slist [(2, "world"), (4, "!"), (1, "Hello")] Slist {sList = [(1,"Hello"),(2,"world"),(4,"!")], sSize = Size 3} -@since x.x.x.x +@since 0.2.0.0 -} sortWith :: Ord b => (a -> b) -> Slist a -> Slist a sortWith f Slist{..} = Slist (Exts.sortWith f sList) sSize diff --git a/src/Slist/Containers.hs b/src/Slist/Containers.hs index 5b96b16..4e07f7c 100644 --- a/src/Slist/Containers.hs +++ b/src/Slist/Containers.hs @@ -8,7 +8,7 @@ Portability: Portable Useful combinators to work with the data structures from @containers@ package and 'Slist' together. -@since x.x.x.x +@since 0.2.0.0 -} module Slist.Containers ( -- * Map @@ -33,7 +33,7 @@ import qualified Data.Set as Set {- | @O(n)@. Returns a 'Slist' of all values of the map in the ascending order of their keys. -@since x.x.x.x +@since 0.2.0.0 -} mapToVals :: Map k v -> Slist v mapToVals m = Slist @@ -45,7 +45,7 @@ mapToVals m = Slist {- | @O(n)@. Returns a 'Slist' of all keys of the map in the ascending order. -@since x.x.x.x +@since 0.2.0.0 -} mapToKeys :: Map k v -> Slist k mapToKeys m = Slist @@ -57,7 +57,7 @@ mapToKeys m = Slist {- | @O(n)@. Returns a 'Slist' of all key-value pairs of the map in the ascending order of their keys. -@since x.x.x.x +@since 0.2.0.0 -} mapToPairs :: Map k v -> Slist (k, v) mapToPairs m = Slist @@ -69,7 +69,7 @@ mapToPairs m = Slist {- | @O(n)@. Returns a 'Slist' of all elements of the set in the ascending order. -@since x.x.x.x +@since 0.2.0.0 -} setToSlist :: Set a -> Slist a setToSlist s = Slist diff --git a/src/Slist/Maybe.hs b/src/Slist/Maybe.hs index 336a4d8..4029ed3 100644 --- a/src/Slist/Maybe.hs +++ b/src/Slist/Maybe.hs @@ -10,7 +10,7 @@ Portability: Portable Useful 'Maybe' combinators to work with the 'Maybe' data type and 'Slist' together. -@since x.x.x.x +@since 0.2.0.0 -} module Slist.Maybe ( maybeToSlist @@ -36,7 +36,7 @@ Slist {sList = [42], sSize = Size 1} >>> maybeToSlist Nothing Slist {sList = [], sSize = Size 0} -@since x.x.x.x +@since 0.2.0.0 -} maybeToSlist :: Maybe a -> Slist a maybeToSlist = maybe mempty one @@ -70,7 +70,7 @@ Reverse is right only on singleton/empty lists maybeToList . slistToMaybe {empty, singleton slist} ≡ {empty, singleton slist} @ -@since x.x.x.x +@since 0.2.0.0 -} slistToMaybe :: Slist a -> Maybe a slistToMaybe = foldr (const . Just) Nothing @@ -84,7 +84,7 @@ slistToMaybe = foldr (const . Just) Nothing >>> catMaybes (cons (Just 1) $ cons Nothing $ one $ Just 3) Slist {sList = [1,3], sSize = Size 2} -@since x.x.x.x +@since 0.2.0.0 -} catMaybes :: Slist (Maybe a) -> Slist a catMaybes = mapMaybe id @@ -106,7 +106,7 @@ If we map the 'Just' constructor, the entire list should be returned: >>> mapMaybe Just s Slist {sList = [1,2,3], sSize = Size 3} -@since x.x.x.x +@since 0.2.0.0 -} mapMaybe :: forall b a . (a -> Maybe b) -> Slist a -> Slist b mapMaybe _ (Slist [] _) = mempty @@ -126,7 +126,7 @@ mapMaybe f (Slist (x:xs) n) = case f x of >>> slistWith maybeEven [1,2,3] Slist {sList = [2], sSize = Size 1} -@since x.x.x.x +@since 0.2.0.0 -} slistWith :: forall b a . (a -> Maybe b) -> [a] -> Slist b slistWith f l = let (n, sl) = go 0 l in Slist sl (Size n)