Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ghc-9.10 #18

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ jobs:
strategy:
matrix:
include:
- compiler: ghc-9.10.1
compilerKind: ghc
compilerVersion: 9.10.1
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.8.2
compilerKind: ghc
compilerVersion: 9.8.2
Expand Down
1 change: 1 addition & 0 deletions strict-containers-lens/strict-containers-lens.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ tested-with:
|| ==9.4.8
|| ==9.6.5
|| ==9.8.2
|| ==9.10.1

library
default-language: Haskell2010
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ tested-with:
|| ==9.4.8
|| ==9.6.5
|| ==9.8.2
|| ==9.10.1

library
default-language: Haskell2010
Expand Down
1 change: 1 addition & 0 deletions strict-containers-tests/strict-containers-tests.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ tested-with:
|| ==9.4.8
|| ==9.6.5
|| ==9.8.2
|| ==9.10.1

test-suite strictness-tests
default-language: Haskell2010
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ import Data.Strict.HashMap.Autogen.Internal.List (isPermutationBy, unorderedComp
import Data.Semigroup (Semigroup (..), stimesIdempotentMonoid)
import GHC.Exts (Int (..), Int#, TYPE, (==#))
import GHC.Stack (HasCallStack)
import Prelude hiding (filter, foldl, foldr, lookup, map,
import Prelude hiding (filter, foldl, foldl', foldr, lookup, map,
null, pred)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@infinity0 Is this the best way to do this? I looked around at the scripts but could not find a better way.

Copy link
Member

@infinity0 infinity0 Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is not the best way. The best way is to

  1. ensure the upstream libraries already support GHC 9.10.
  2. update the versions inside strict-containers/regen.sh to the versions that support GHC 9.10, and then re-run it. ideally this Just Works and there's nothing else to do.
  3. if this fails, then adjust our patches in strict-containers/patches/, and retry (2)
  4. if (3) is too hard to do manually, then strict-containers/update-patches-from-git.sh can help automate part of this process, but you should understand exactly what it's doing as it may mess up your git repo if run incorrectly

I just checked however, and:

  • (1) already fails because the latest released versions of containers (0.7) and unordered-containers (0.2.20) don't yet support GHC 9.10, they don't import hiding foldl'.
  • containers master branch does support GHC 9.10, however unordered-containers doesn't.
  • edit: also should wait for vector to release, so we can do Drop Vector patches #16, which presumably will also include GHC 9.10 support.

I suggest you wait until all these libraries have released versions that support GHC 9.10 before proceeding with this PR. At the very least, your patch here should be applied to the unordered-containers git repo before we proceed with changes in this library.

After that (i.e. contributing to unordered-containers, so that all 3 upstream git repos have master branches that support GHC 9.10), you could optionally experiment with changing the versions in regen.sh to master, but this may result in duplicate unnecessary work if the upstream libraries make further changes that invalidate our new adjusted patches. So that's why I suggest to wait until all libraries have released (tagged) versions that support GHC 9.10.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, i will not merge this PR as is, I will try the above.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(1) already fails because the latest released versions of containers (0.7) and unordered-containers (0.2.20) don't yet support GHC 9.10

Both packages do support GHC 9.10.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Bodigrim I checked the source code and they don't hiding foldl' like this PR was proposing, how could they support GHC 9.10 without that?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@infinity0 I'm not sure what you are looking at. I just checked, say, https://hackage.haskell.org/package/containers-0.7/docs/src/Data.IntMap.Strict.Internal.html - it does hide foldl'.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right I was too hasty with a text search, used a regex that only looked on one line.

And unordered-containers has haskell-unordered-containers/unordered-containers@259dc9e which achieves the same without mentioning foldl' at all.

Ok in that case all that's needed is to wait for vector to release, the latest version 0.13.1.0 doesn't hide foldl' but its master branch does.

Then, some of the patches will have to be updated too.

vector @ 0.13.1.0 already invalidates the existing patches
diff --git a/strict-containers/regen.sh b/strict-containers/regen.sh
index a96bec1..25ed7d0 100755
--- a/strict-containers/regen.sh
+++ b/strict-containers/regen.sh
@@ -111,9 +111,9 @@ copy_test_and_rename() {
 if [ -z "$CLEAN" ]; then
        VERSIONS_CABAL=versions.cabal.in
        rm -f $VERSIONS_CABAL
-       ensure_checkout containers v0.6.6
-       ensure_checkout unordered-containers v0.2.19.1
-       ensure_checkout vector vector-0.13.0.0
+       ensure_checkout containers v0.7
+       ensure_checkout unordered-containers v0.2.20
+       ensure_checkout vector vector-0.13.1.0
        cat $VERSIONS_CABAL | fixup_cabal versions ""
        rm -f $VERSIONS_CABAL
 else
[..]
patching file src/Data/Strict/Vector/Autogen/Mutable.hs
Hunk #2 succeeded at 135 (offset 2 lines).
Hunk #3 succeeded at 144 (offset 2 lines).
patching file tests/Tests/Move.hs
patching file tests/Tests/Vector.hs
patching file tests/Tests/Vector/Boxed.hs
patching file tests/Tests/Vector/UnitTests.hs
patching file tests/Utilities.hs
Hunk #1 FAILED at 5.
containers @ master (> 0.7) invalidates the existing patches
diff --git a/strict-containers/regen.sh b/strict-containers/regen.sh
index a96bec1..25ed7d0 100755
--- a/strict-containers/regen.sh
+++ b/strict-containers/regen.sh
@@ -111,9 +111,9 @@ copy_test_and_rename() {
 if [ -z "$CLEAN" ]; then
        VERSIONS_CABAL=versions.cabal.in
        rm -f $VERSIONS_CABAL
-       ensure_checkout containers v0.6.6
-       ensure_checkout unordered-containers v0.2.19.1
-       ensure_checkout vector vector-0.13.0.0
+       ensure_checkout containers master
+       ensure_checkout unordered-containers master
+       ensure_checkout vector master
        cat $VERSIONS_CABAL | fixup_cabal versions ""
        rm -f $VERSIONS_CABAL
 else
[..]
patching file src/Data/Strict/Map/Autogen/Internal.hs
Hunk #1 succeeded at 467 (offset 9 lines).
patching file src/Data/Strict/IntMap/Autogen/Internal.hs
Hunk #1 FAILED at 359.
1 out of 1 hunk FAILED -- saving rejects to file src/Data/Strict/IntMap/Autogen/Internal.hs.rej

Copy link
Collaborator Author

@erikd erikd Jul 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hackage has a version that could be used, but the scripts rely on the version in git and the version is git is on v0.6.8.

I have raised an issue: haskell/containers#1012

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import Text.Read hiding (step)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ import GHC.Exts (Int (..), SmallArray#, SmallMutableArray#,
unsafeFreezeSmallArray#, unsafeThawSmallArray#,
writeSmallArray#)
import GHC.ST (ST (..))
import Prelude hiding (all, filter, foldMap, foldl, foldr, length,
import Prelude hiding (all, filter, foldMap, foldl, foldl', foldr, length,
map, read, traverse)

import qualified GHC.Exts as Exts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ import Control.DeepSeq (NFData(rnf))
import Data.Bits
import qualified Data.Foldable as Foldable
import Data.Maybe (fromMaybe)
import Prelude hiding (lookup, map, filter, foldr, foldl, null)
import Prelude hiding (lookup, map, filter, foldr, foldl, foldl', null)

import Data.IntSet.Internal (Key)
import qualified Data.IntSet.Internal as IntSet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ module Data.Strict.IntMap.Autogen.Strict.Internal (
#endif
) where

import Prelude hiding (lookup,map,filter,foldr,foldl,null)
import Prelude hiding (lookup,map,filter,foldr,foldl,foldl',null)

import Data.Bits
import qualified Data.Strict.IntMap.Autogen.Internal as L
Expand Down
2 changes: 1 addition & 1 deletion strict-containers/src/Data/Strict/Map/Autogen/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ import qualified Data.Foldable as Foldable
#if MIN_VERSION_base(4,10,0)
import Data.Bifoldable
#endif
import Prelude hiding (lookup, map, filter, foldr, foldl, null, splitAt, take, drop)
import Prelude hiding (lookup, map, filter, foldr, foldl, foldl', null, splitAt, take, drop)

import qualified Data.Set.Internal as Set
import Data.Set.Internal (Set)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ module Data.Strict.Map.Autogen.Strict.Internal
, valid
) where

import Prelude hiding (lookup,map,filter,foldr,foldl,null,take,drop,splitAt)
import Prelude hiding (lookup,map,filter,foldr,foldl,foldl',null,take,drop,splitAt)

import Data.Strict.Map.Autogen.Internal
( Map (..)
Expand Down
2 changes: 1 addition & 1 deletion strict-containers/src/Data/Strict/Vector/Autogen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ import Prelude hiding ( length, null,
zipWith, zipWith3, zip, zip3, unzip, unzip3,
filter, takeWhile, dropWhile, span, break,
elem, notElem,
foldl, foldl1, foldr, foldr1, foldMap,
foldl, foldl', foldl1, foldr, foldr1, foldMap,
all, any, and, or, sum, product, minimum, maximum,
scanl, scanl1, scanr, scanr1,
enumFromTo, enumFromThenTo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ import Data.Strict.Vector.Autogen.Internal.Check
import Data.Primitive.Array
import Control.Monad.Primitive

import Prelude hiding ( length, null, replicate, reverse, read,
import Prelude hiding ( length, foldl', null, replicate, reverse, read,
take, drop, splitAt, init, tail, foldr, foldl, mapM_ )

import Data.Typeable ( Typeable )
Expand Down
1 change: 1 addition & 0 deletions strict-containers/strict-containers.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ tested-with:
|| ==9.4.8
|| ==9.6.5
|| ==9.8.2
|| ==9.10.1

library
default-language: Haskell2010
Expand Down
2 changes: 1 addition & 1 deletion strict-containers/tests/intmap-properties.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Data.Ord
import Data.Foldable (foldMap)
import Data.Function
import Data.Traversable (Traversable(traverse), foldMapDefault)
import Prelude hiding (lookup, null, map, filter, foldr, foldl)
import Prelude hiding (lookup, null, map, filter, foldr, foldl, foldl')
import qualified Prelude (map)

import Data.List (nub,sort)
Expand Down
2 changes: 1 addition & 1 deletion strict-containers/tests/map-properties.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import qualified Data.Foldable as Foldable
#if MIN_VERSION_base(4,10,0)
import qualified Data.Bifoldable as Bifoldable
#endif
import Prelude hiding (lookup, null, map, filter, foldr, foldl, take, drop, splitAt)
import Prelude hiding (lookup, null, map, filter, foldr, foldl, foldl', take, drop, splitAt)
import qualified Prelude

import Data.List (nub,sort)
Expand Down