Skip to content

Commit

Permalink
Prepare 0.2.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
vrom911 committed Mar 18, 2021
1 parent bf84c7d commit a95dd0e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion slist.cabal
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
18 changes: 10 additions & 8 deletions src/Slist.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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{..}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/Slist/Containers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/Slist/Maybe.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit a95dd0e

Please sign in to comment.