From 8b501febd860e8a5ebfaeeec5392214e2488e3a0 Mon Sep 17 00:00:00 2001 From: martoon Date: Fri, 23 Jun 2023 18:30:04 +0300 Subject: [PATCH 1/9] [Chore] Test against `GHC-9.4.5` in CI Problem: we aim at supporting the recent LTS-21.0 which uses GHC-9.4.5. That is two minor versions ahead from the recent GHC we currently test with, so let's include GHC-9.4.5 in the list too. Solution: * add `GHC-9.4.5` to our `ci.yml` + also update used `stack` version by the way * remove the oldest `GHC-8.6.5` * update `tested-with` section in `.cabal` file accordingly --- .github/workflows/ci.yml | 16 ++++++++-------- universum.cabal | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66bfdad..3553d84 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,29 +31,29 @@ jobs: strategy: matrix: os: [ubuntu-latest, macOS-latest, windows-latest] - cabal: ["3.6"] + cabal: ["3.8"] # If you update this list of supported compiler versions, # make sure to update the `tested-with` section of `universum.cabal`. ghc: - - "8.6.5" - "8.8.4" - "8.10.7" - "9.0.1" - "9.2.2" + - "9.4.5" # Use only the latest compiler on non-Linux exclude: + - os: macOS-latest + ghc: 9.2.2 - os: macOS-latest ghc: 9.0.1 - os: macOS-latest ghc: 8.8.4 - - os: macOS-latest - ghc: 8.6.5 + - os: windows-latest + ghc: 9.2.2 - os: windows-latest ghc: 9.0.1 - os: windows-latest ghc: 8.8.4 - - os: windows-latest - ghc: 8.6.5 steps: - uses: actions/checkout@v3 @@ -91,8 +91,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - stack: ["2.7"] - ghc: ["9.0.2"] + stack: ["2.9.3"] + ghc: ["9.4.5"] steps: - uses: actions/checkout@v3 diff --git a/universum.cabal b/universum.cabal index 22c0e5f..92fb70c 100644 --- a/universum.cabal +++ b/universum.cabal @@ -13,11 +13,11 @@ category: Prelude stability: stable build-type: Simple bug-reports: https://github.com/serokell/universum/issues -tested-with: GHC == 8.6.5 - , GHC == 8.8.4 +tested-with: GHC == 8.8.4 , GHC == 8.10.7 , GHC == 9.0.1 , GHC == 9.2.2 + , GHC == 9.4.5 extra-doc-files: CHANGES.md , CONTRIBUTING.md , README.md From f7be1c7821b6c2049e2076059cfbdaeb2ae1ad00 Mon Sep 17 00:00:00 2001 From: martoon Date: Fri, 23 Jun 2023 18:50:32 +0300 Subject: [PATCH 2/9] [Chore] Fix `Eq` redundant constraints Problem: apparently after the recent addition of `Eq` superclass to `Hashable` and our attempts to fix that in be020754619080b02ec0f9fb4cea0279bbf8f5a9, some redundant constraints remained (GHC does not always recognize redundant constraints). With GHC-9.4 this brings us warnings. Solution: use `MIN_VERSION` pragma to remove `Eq` constraint for `hashable >= 1.4.0`. --- src/Universum/Container/Class.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Universum/Container/Class.hs b/src/Universum/Container/Class.hs index 3a483cd..81b1246 100644 --- a/src/Universum/Container/Class.hs +++ b/src/Universum/Container/Class.hs @@ -231,9 +231,13 @@ instance FromList (NonEmpty a) where instance FromList IntSet instance Ord a => FromList (Set a) -instance (Eq k, Hashable k) => FromList (HashMap k v) instance FromList (IntMap v) instance Ord k => FromList (Map k v) +#if MIN_VERSION_hashable(1,4,0) +instance (Hashable k) => FromList (HashMap k v) +#else +instance (Eq k, Hashable k) => FromList (HashMap k v) +#endif instance FromList T.Text instance FromList TL.Text @@ -575,7 +579,11 @@ instance Ord v => Container (Set v) where notElem = Set.notMember {-# INLINE notElem #-} +#if MIN_VERSION_hashable(1,4,0) +instance (Hashable v) => Container (HashSet v) where +#else instance (Eq v, Hashable v) => Container (HashSet v) where +#endif elem = HashSet.member {-# INLINE elem #-} From 91a6b454c82a8813b51fa70903dff14e5dbe13b3 Mon Sep 17 00:00:00 2001 From: martoon Date: Fri, 23 Jun 2023 18:53:54 +0300 Subject: [PATCH 3/9] [Chore] Fix redundant import warning Problem: one import is necessary for the rewrite rule, and this rule is disabled for `text >= 2.0.2`. Solution: disable the import conditionally in the same way. --- src/Universum/String/Conversion.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Universum/String/Conversion.hs b/src/Universum/String/Conversion.hs index acf77a5..d9a3c9f 100644 --- a/src/Universum/String/Conversion.hs +++ b/src/Universum/String/Conversion.hs @@ -34,7 +34,10 @@ import Data.Function (id, (.)) import Data.Maybe (Maybe) import Data.String (String) import qualified Data.Text.Internal as T + +#if !MIN_VERSION_text(2,0,2) import qualified Data.Text.Internal.Fusion.Common as TF +#endif import Universum.Functor ((<$>)) import Universum.String.Reexport (ByteString, IsString, Read, Text, fromString) From 0090a11f55c9f9daa67a825ed6df9d135cc57f92 Mon Sep 17 00:00:00 2001 From: martoon Date: Fri, 23 Jun 2023 19:03:19 +0300 Subject: [PATCH 4/9] [Chore] Account for new `(~)` operator Problem: nowadays `~` is not a built-in operator, rather a definition coming from `Data.Type.Equality`. This makes `VarArg` module fail. Solution: add a conditional import to `VarArg` module. Also, start re-exporting the `~` operator from universum. --- src/Universum/Base.hs | 7 +++++++ src/Universum/Monad/Container.hs | 4 ++++ src/Universum/VarArg.hs | 6 ++++++ universum.cabal | 2 ++ 4 files changed, 19 insertions(+) diff --git a/src/Universum/Base.hs b/src/Universum/Base.hs index 6b657fd..a191be8 100644 --- a/src/Universum/Base.hs +++ b/src/Universum/Base.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE BangPatterns #-} {-# LANGUAGE Unsafe #-} @@ -24,6 +25,9 @@ module Universum.Base , module Data.Proxy , module Data.Typeable , module Data.Void +#if MIN_VERSION_base(4,17,0) + , module Data.Type.Equality +#endif , module GHC.Base , module GHC.Enum @@ -67,6 +71,9 @@ import Data.Traversable (Traversable (..), fmapDefault, foldMapDefault, forM, ma import Data.Proxy (Proxy (..)) import Data.Typeable (Typeable) import Data.Void (Void, absurd, vacuous) +#if MIN_VERSION_base(4,17,0) +import Data.Type.Equality (type (~)) +#endif import GHC.Base (String, asTypeOf, maxInt, minInt, ord, seq) import GHC.Enum (Bounded (..), Enum (..), boundedEnumFrom, boundedEnumFromThen) diff --git a/src/Universum/Monad/Container.hs b/src/Universum/Monad/Container.hs index 64b89cc..355daf1 100644 --- a/src/Universum/Monad/Container.hs +++ b/src/Universum/Monad/Container.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE Trustworthy #-} {-# LANGUAGE TypeFamilies #-} @@ -18,6 +19,9 @@ import Control.Applicative (Applicative (pure)) import Data.Function ((.)) import Data.Traversable (Traversable (traverse)) import Prelude (Bool (..), Monoid, flip) +#if MIN_VERSION_base(4,17,0) +import Data.Type.Equality (type (~)) +#endif import Universum.Base (IO) import Universum.Container (Container, Element, fold, toList) diff --git a/src/Universum/VarArg.hs b/src/Universum/VarArg.hs index 18f7cae..c9c687b 100644 --- a/src/Universum/VarArg.hs +++ b/src/Universum/VarArg.hs @@ -1,9 +1,11 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE Safe #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} -- | Provides operator of variable-arguments function composition. @@ -12,6 +14,10 @@ module Universum.VarArg ( SuperComposition(..) ) where +#if MIN_VERSION_base(4,17,0) +import Data.Type.Equality (type (~)) +#endif + -- $setup -- >>> import Universum.Base ((+)) -- >>> import Universum.Container (null) diff --git a/universum.cabal b/universum.cabal index 92fb70c..88e5425 100644 --- a/universum.cabal +++ b/universum.cabal @@ -48,6 +48,8 @@ common common-options default-language: Haskell2010 + default-extensions: TypeOperators + library import: common-options hs-source-dirs: src From bb9f05c6db72fed1d05d74be68d9a73d145d3265 Mon Sep 17 00:00:00 2001 From: martoon Date: Fri, 23 Jun 2023 18:21:45 +0300 Subject: [PATCH 5/9] [Chore] Prepare a release Problem: `universum` has been excluded from the recent LTS, at least because we do not support the most recent version of `text` package. This issue with `text` has been fixed, and we need a new version with the fix. Solution: bump the version from `1.8.1.2` to `1.8.2`, since among changes in definitions we only started exporting `~`. --- CHANGES.md | 11 ++++++++++- universum.cabal | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index f14a9ef..e1e1d60 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,8 +1,17 @@ +1.8.2 +===== + +* [#289](https://github.com/serokell/universum/pull/289): + Make universum work with LTS-21.0. + * Re-export `(~)` type operator. +* [#283](https://github.com/serokell/universum/pull/283): + Bump the upper version bound on `text` to `2.0.2`. + 1.8.1.1 ======= * [#282](https://github.com/serokell/universum/pull/282): - Bump version bound on `text` to `2.0.1`. + Bump the upper version bound on `text` to `2.0.1`. 1.8.1 ===== diff --git a/universum.cabal b/universum.cabal index 88e5425..dec366f 100644 --- a/universum.cabal +++ b/universum.cabal @@ -1,6 +1,6 @@ cabal-version: 2.2 name: universum -version: 1.8.1.1 +version: 1.8.2 synopsis: Custom prelude used in Serokell description: See README.md file for more details. homepage: https://github.com/serokell/universum From 5b0a8ac5af24514c7ed51a88bc59031ad66964bb Mon Sep 17 00:00:00 2001 From: martoon Date: Fri, 23 Jun 2023 19:41:53 +0300 Subject: [PATCH 6/9] [Chore] Set lts-21.0 in `stack.yaml` --- stack.yaml | 2 +- stack.yaml.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/stack.yaml b/stack.yaml index 583ba6b..bb875e4 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1 +1 @@ -resolver: lts-19.0 +resolver: lts-21.0 diff --git a/stack.yaml.lock b/stack.yaml.lock index c3e0aa0..ad1be6c 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -6,7 +6,7 @@ packages: [] snapshots: - completed: - size: 616897 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/0.yaml - sha256: bbf2be02f17940bac1f87cb462d4fb0c3355de6dcfc53d84f4f9ad3ee2164f65 - original: lts-19.0 + sha256: 1867d84255dff8c87373f5dd03e5a5cb1c10a99587e26c8793e750c54e83ffdc + size: 639139 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/0.yaml + original: lts-21.0 From 32c3f2ff72625139ec1b88320803b2cd01e77e2c Mon Sep 17 00:00:00 2001 From: Nikolay Yakimov Date: Mon, 26 Jun 2023 20:05:07 +0300 Subject: [PATCH 7/9] [Chore] Exclude GHC 8.10.7 on non-Linux from tests Problem: the comment in the CI config says "Use only the latest compiler on non-Linux", but GHC 8.10.7 is also included for some reason. Solution: exclude it. --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3553d84..e65bf52 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,12 +48,16 @@ jobs: ghc: 9.0.1 - os: macOS-latest ghc: 8.8.4 + - os: macOS-latest + ghc: 8.10.7 - os: windows-latest ghc: 9.2.2 - os: windows-latest ghc: 9.0.1 - os: windows-latest ghc: 8.8.4 + - os: windows-latest + ghc: 8.10.7 steps: - uses: actions/checkout@v3 From 69e9d32f47cf3d5ab3b21c46753d041b01807054 Mon Sep 17 00:00:00 2001 From: martoon Date: Tue, 27 Jun 2023 18:49:27 +0300 Subject: [PATCH 8/9] [Chore] Bump patch-versions of older GHC versions Problem: older versions of GHC we test against have got new patches, and new versions `9.0.2` and `9.2.8` are supported. Solution: test against them in CI. --- .github/workflows/ci.yml | 12 ++++++------ universum.cabal | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e65bf52..d82aaf7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,23 +37,23 @@ jobs: ghc: - "8.8.4" - "8.10.7" - - "9.0.1" - - "9.2.2" + - "9.0.2" + - "9.2.8" - "9.4.5" # Use only the latest compiler on non-Linux exclude: - os: macOS-latest - ghc: 9.2.2 + ghc: 9.2.8 - os: macOS-latest - ghc: 9.0.1 + ghc: 9.0.2 - os: macOS-latest ghc: 8.8.4 - os: macOS-latest ghc: 8.10.7 - os: windows-latest - ghc: 9.2.2 + ghc: 9.2.8 - os: windows-latest - ghc: 9.0.1 + ghc: 9.0.2 - os: windows-latest ghc: 8.8.4 - os: windows-latest diff --git a/universum.cabal b/universum.cabal index dec366f..f23e429 100644 --- a/universum.cabal +++ b/universum.cabal @@ -15,8 +15,8 @@ build-type: Simple bug-reports: https://github.com/serokell/universum/issues tested-with: GHC == 8.8.4 , GHC == 8.10.7 - , GHC == 9.0.1 - , GHC == 9.2.2 + , GHC == 9.0.2 + , GHC == 9.2.8 , GHC == 9.4.5 extra-doc-files: CHANGES.md , CONTRIBUTING.md From 0b16c4b43508a2b1c5555fc6451dd47514679c43 Mon Sep 17 00:00:00 2001 From: martoon Date: Tue, 27 Jun 2023 19:01:24 +0300 Subject: [PATCH 9/9] [Chore] Mention `Unreleased` section in PR template Problem: it's not really fixed anywhere, whether should we have an empty `Unreleased` section in our changelog, or better go without it. Solution: we agreed with @gromak that it's better to leave no empty section (so that it does not appear on Hackage). So as a clarification, on our PR template I change the point about changelog (for regular PRs, not as part of release routine) to mention the creation of `Unreleased` section if it is absent. --- .github/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7ea568c..8866e5f 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -49,7 +49,7 @@ checkmark indicating that you are sure it is dealt with (be that by irrelevance) - Record your changes - - [ ] I added an entry to the [changelog](https://github.com/serokell/universum/tree/master/CHANGES.md) if my changes are visible to the users + - [ ] I added an entry to the [changelog](https://github.com/serokell/universum/tree/master/CHANGES.md) (creating the `Unreleased` section if necessary) if my changes are visible to the users and - [ ] provided a migration guide for breaking changes if possible