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

Build failure in a released version when using an older version of 'containers' #404

Closed
chris-martin opened this issue Apr 2, 2022 · 2 comments · Fixed by #413
Closed
Assignees

Comments

@chris-martin
Copy link
Contributor

I tried to build relude-1.0.0.1 with containers-0.5.7.1 using GHC 8.8.4 and got a compile error:

src/Relude/Nub.hs:62:1: error:
Error:     Could not load module ‘Data.Containers.ListUtils’
    It is a member of the hidden package ‘containers-0.6.2.1’.
    Perhaps you need to add ‘containers’ to the build-depends in your .cabal file.
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
62 | import qualified Data.Containers.ListUtils as Containers
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This module was added in containers-0.6.0.1, so I'm thinking maybe it was a mistake for containers-0.5.7.1 to be in bounds?

@chshersh
Copy link
Contributor

containers is a boot library so old GHC versions will use older versions of containers library. The earliest GHC version supported by Relude is 8.2.2 and this GHC versions ships with containers-0.5.10.2.

So, bumping up the lower bound from 0.5.7 to 0.5.10.2 is the correct thing to do nevertheless. But it won't solve your issue as 0.5.10.2 still doesn't have the Data.Containers.ListUtils module. However, I don't think this is a problem as Relude uses CPP to support older containers versions:

relude/src/Relude/Nub.hs

Lines 80 to 85 in fcb3225

ordNub :: forall a . (Ord a) => [a] -> [a]
#if __GLASGOW_HASKELL__ > 804
ordNub = Containers.nubOrd
{-# INLINE ordNub #-}
#else
ordNub = go Set.empty

It's more surprising to me how you're using GHC with different versions of boot libraries instead of shipped one 🤔 But I guess it never was the expectation from relude to support "non-standard" combinations of GHC and boot library versions. I personally wasn't aware this is possible or supported.

You could try to bump up the lower bound for containers to 0.6 and see how the CI goes and whether it still works with old GHC versions. And if yes, CPP can be removed and the code will become cleaner 🧹 🙂

@sjakobi
Copy link

sjakobi commented May 27, 2022

Even though containers is a boot library, cabal or stack aren't forced to use the version bundled with GHC.

Only the builtin subset of the boot libraries is non-upgradeable, e.g. base, template-haskell and the ghc* packages.

So the CPP on ordNub should refer to the containers version instead to the GHC version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants