Skip to content

Commit

Permalink
[#56] Support GHC-9.4 (#57)
Browse files Browse the repository at this point in the history
Resolves #56
  • Loading branch information
vrom911 committed Nov 3, 2022
1 parent c8c73f6 commit 09e7c42
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
- "8.10.7"
- "9.0.2"
- "9.2.4"
- "9.4.2"

steps:
- uses: actions/checkout@v3
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
`slist` uses [PVP Versioning][1].
The changelog is available [on GitHub][2].

## 0.2.1.0 – Nov 3, 2022

* [#56](https://github.com/kowainik/slist/issues/56):
Support GHC-9.4.

## 0.2.0.1 – Oct 7, 2022

* [#53](https://github.com/kowainik/slist/issues/53):
Expand Down
10 changes: 8 additions & 2 deletions slist.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: slist
version: 0.2.0.1
version: 0.2.1.0
synopsis: Sized list
description: This package implements @Slist@ data structure that stores the size
of the list along with the list itself.
Expand All @@ -23,13 +23,14 @@ tested-with: GHC == 8.2.2
, GHC == 8.10.7
, GHC == 9.0.2
, GHC == 9.2.4
, GHC == 9.4.2

source-repository head
type: git
location: https://github.com/kowainik/slist.git

common common-options
build-depends: base >= 4.10.1.0 && < 4.17
build-depends: base >= 4.10.1.0 && < 4.18

ghc-options: -Wall
-Wincomplete-uni-patterns
Expand All @@ -43,6 +44,11 @@ common common-options
-Werror=missing-deriving-strategies
if impl(ghc >= 8.10.1)
ghc-options: -Wunused-packages
if impl(ghc >= 9.0)
ghc-options: -Winvalid-haddock
if impl(ghc >= 9.2)
ghc-options: -Wredundant-bang-patterns
-Woperator-whitespace

default-extensions: ConstraintKinds
DeriveGeneric
Expand Down
12 changes: 8 additions & 4 deletions src/Slist.hs
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ It is recommended to use 'safeHead' instead.
1
>>> head mempty
*** Exception: Prelude.head: empty list
...
-}
head :: Slist a -> a
Expand Down Expand Up @@ -415,6 +416,7 @@ It is recommended to use 'safeLast' instead
'y'
>>> last mempty
*** Exception: Prelude.last: empty list
...
@
>> last $ infiniteSlist [1..]
Expand Down Expand Up @@ -677,7 +679,7 @@ permutations (Slist l s) = Slist

go :: Int -> Int -> Int
go !acc 0 = acc
go !acc n = go (acc * n) (n - 1)
go acc n = go (acc * n) (n - 1)
{-# INLINE permutations #-}

----------------------------------------------------------------------------
Expand Down Expand Up @@ -937,7 +939,7 @@ takeWhile p Slist{..} = let (s, l) = go 0 sList in
where
go :: Int -> [a] -> (Int, [a])
go !n [] = (n, [])
go !n (x:xs) =
go n (x:xs) =
if p x
then let (i, l) = go (n + 1) xs in (i, x:l)
else (n, [])
Expand Down Expand Up @@ -967,7 +969,7 @@ dropWhile p Slist{..} = let (s, l) = go 0 sList in
where
go :: Int -> [a] -> (Int, [a])
go !n [] = (n, [])
go !n (x:xs) =
go n (x:xs) =
if p x
then go (n + 1) xs
else (n, x:xs)
Expand Down Expand Up @@ -997,7 +999,7 @@ span p Slist{..} = let (s, l, r) = go 0 sList in
where
go :: Int -> [a] -> (Int, [a], [a])
go !n [] = (n, [], [])
go !n (x:xs) =
go n (x:xs) =
if p x
then let (s, l, r) = go (n + 1) xs in (s, x:l, r)
else (n, [], x:xs)
Expand Down Expand Up @@ -1476,8 +1478,10 @@ it throws the exception at run-time.
1
>>> unsafeAt (-1) sl
*** Exception: Prelude.!!: negative index
...
>>> unsafeAt 11 sl
*** Exception: Prelude.!!: index too large
...
>>> unsafeAt 9 sl
10
-}
Expand Down
2 changes: 1 addition & 1 deletion src/Slist/Maybe.hs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ slistWith f l = let (n, sl) = go 0 l in Slist sl (Size n)
where
go :: Int -> [a] -> (Int, [b])
go !accSize [] = (accSize, [])
go !accSize (x:xs) = case f x of
go accSize (x:xs) = case f x of
Nothing -> go accSize xs
Just r -> second (r:) $ go (accSize + 1) xs

Expand Down

0 comments on commit 09e7c42

Please sign in to comment.