Skip to content

Commit f58402e

Browse files
authored
Ghc 9.8 upgrade (#1460)
* Bump cabal index state. * Make tls/crypton work. * Thread a connection manager which allows EMS around. * Bump again. * Another bump. * Commentary for reverting the AllowEMS change. * Make fourmolu happy. * Bump versions/packages for compatibility with GHC 9.8. * Fmt fix... * Compatible liftA2 * Format 😢 * Attempt a build. Still need to do haskell-dev-tools eventually. * Turn x-partial into a warning for unit tests. * Attempt to addressing breaking warnings/errors. * Turn off the new x-partial warnings. * Format cabal file. * Update docs, workflows and makefiles to use ghc-9.8. * Lint with new haskell-dev-tools. * Make a release. * learnyouahaskell.com seems to be down. There is a community fork which may be more reliable/up-to-date anyway: https://learnyouahaskell.github.io. * Fix benches.
1 parent cfbcd5b commit f58402e

File tree

22 files changed

+63
-45
lines changed

22 files changed

+63
-45
lines changed

.github/workflows/bench.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
benchmarks:
66
name: benchmarks
77
runs-on: ubuntu-latest
8-
container: fossa/haskell-static-alpine:ghc-9.4.8
8+
container: fossa/haskell-static-alpine:ghc-9.8.2
99

1010
steps:
1111
- uses: dtolnay/rust-toolchain@stable

.github/workflows/build-all.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ${{ matrix.os }}
1111
container: ${{ matrix.container }}
1212
env:
13-
GHC_VERSION: '9.4.8'
13+
GHC_VERSION: '9.8.2'
1414

1515

1616
defaults:
@@ -23,25 +23,25 @@ jobs:
2323
include:
2424
- os: ubuntu-latest
2525
os-name: Linux
26-
container: fossa/haskell-static-alpine:ghc-9.4.8
26+
container: fossa/haskell-static-alpine:ghc-9.8.2
2727
project-file: cabal.project.ci.linux
28-
ghc: '9.4.8'
28+
ghc: '9.8.2'
2929

3030
# macos-latest pointed at macos-12 this before it was changed to ARM.
3131
- os: macos-12
3232
os-name: macOS-intel
3333
project-file: cabal.project.ci.macos
34-
ghc: '9.4.8'
34+
ghc: '9.8.2'
3535

3636
- os: windows-latest
3737
os-name: Windows
3838
project-file: cabal.project.ci.windows
39-
ghc: '9.4.8'
39+
ghc: '9.8.2'
4040

4141
- os: macos-latest
4242
os-name: macOS-arm64
4343
project-file: cabal.project.ci.macos
44-
ghc: '9.4.8'
44+
ghc: '9.8.2'
4545

4646
steps:
4747

@@ -62,7 +62,7 @@ jobs:
6262
if: ${{ !contains(matrix.os, 'ubuntu') }}
6363
with:
6464
ghc-version: ${{ matrix.ghc }}
65-
cabal-version: '3.10.2.1'
65+
cabal-version: '3.10.3.0'
6666

6767
# Set up Rust.
6868
# This action installs the 'minimal' profile.
@@ -315,8 +315,8 @@ jobs:
315315
echo ${GITHUB_SHA:0:12}
316316
317317
VERSION=$(echo $(Linux-binaries/fossa --version))
318-
EXPECTED="fossa-cli version ${{ steps.get-version.outputs.VERSION }} (revision ${GITHUB_SHA:0:12} compiled with ghc-9.4)"
319-
echo " VERSION: $VERSION"
318+
EXPECTED="fossa-cli version ${{ steps.get-version.outputs.VERSION }} (revision ${GITHUB_SHA:0:12} compiled with ghc-9.8)"
319+
echo "VERSION: $VERSION"
320320
echo "EXPECTED: $EXPECTED"
321321
322322
[ "$GITHUB_REF_TYPE" = "tag" ] && echo "Ref type OK"

.github/workflows/integrations-test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
name: integration-test
1414
runs-on: "fossa-cli-integration-runner"
1515
# Be sure to update the env below too
16-
container: fossa/haskell-static-alpine:ghc-9.4.8
16+
container: fossa/haskell-static-alpine:ghc-9.8.2
1717

1818
env:
19-
GHC_VERSION: '9.4.8'
19+
GHC_VERSION: '9.8.2'
2020

2121
steps:
2222
- uses: dtolnay/rust-toolchain@stable

.github/workflows/lint.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
linter-check:
77
name: linter-check
88
runs-on: ubuntu-latest
9-
container: ghcr.io/fossas/haskell-dev-tools:9.4.8
9+
container: ghcr.io/fossas/haskell-dev-tools:9.8.2
1010

1111
steps:
1212
- uses: dtolnay/rust-toolchain@stable
@@ -39,7 +39,7 @@ jobs:
3939
format-check:
4040
name: formatter-check
4141
runs-on: ubuntu-latest
42-
container: ghcr.io/fossas/haskell-dev-tools:9.4.8
42+
container: ghcr.io/fossas/haskell-dev-tools:9.8.2
4343

4444
steps:
4545
- uses: dtolnay/rust-toolchain@stable
@@ -56,7 +56,7 @@ jobs:
5656
cabal-format-check:
5757
name: cabal-format-check
5858
runs-on: ubuntu-latest
59-
container: ghcr.io/fossas/haskell-dev-tools:9.4.8
59+
container: ghcr.io/fossas/haskell-dev-tools:9.8.2
6060

6161
steps:
6262
- uses: actions/checkout@v4

Changelog.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# FOSSA CLI Changelog
22

3-
## Unreleased
3+
## 3.9.31
44

55
- Resolve an issue parsing toml configuration files. ([#1459](https://github.com/fossas/fossa-cli/pull/1459))
66
- Gradle: ignore deprecated configurations ([#1457](https://github.com/fossas/fossa-cli/pull/1457))
7+
- Upgrade the GHC we use to build the CLI. ([#1460](https://github.com/fossas/fossa-cli/pull/1460))
78

89
## 3.9.30
910

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ current_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
33

44
FMT_OPTS := -co -XTypeApplications -o -XImportQualifiedPost
55
FIND_OPTS := src test integration-test -type f -name '*.hs'
6-
GHC_VERSION := 9.4.8
6+
GHC_VERSION := 9.8.2
77
DEV_TOOLS := ghcr.io/fossas/haskell-dev-tools:${GHC_VERSION}
88
MOUNTED_DEV_TOOLS_OPTS := --rm
99
MOUNTED_DEV_TOOLS_OPTS += --mount "type=bind,source=${current_dir},target=/fossa-cli"

cabal.project.ci.linux

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ packages: .
99
import: ./cabal.project.common
1010

1111
package spectrometer
12-
ghc-options: -Werror
12+
ghc-options: -Werror -Wwarn=x-partial

cabal.project.ci.macos

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ packages: .
77
import: ./cabal.project.common
88

99
package spectrometer
10-
ghc-options: -Werror
10+
ghc-options: -Werror -Wwarn=x-partial

cabal.project.ci.windows

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ packages: .
99
import: ./cabal.project.common
1010

1111
package spectrometer
12-
ghc-options: -Werror
12+
ghc-options: -Werror -Wwarn=x-partial

cabal.project.common

+11-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ allow-newer:
1414
-- was in 2018, so we may have to fork when breakage occurs
1515
, codec-rpm:attoparsec
1616

17+
-- transformers has a few breaking changes from 0.5 -> 0.6.
18+
-- But the removed symbols were already deprecated in 0.5.
19+
-- fused-effects-exceptions has a PR out: https://github.com/fused-effects/fused-effects-exceptions/pull/22
20+
-- When that merges you should be able to remove it from here.
21+
-- lzma-conduit seems kind of moribund.
22+
-- I've left an issue checking for signs of life: https://github.com/alphaHeavy/lzma-conduit/issues/27
23+
-- I'll make a PR if someone responds. The lib is small enough we could just vendor it if not.
24+
, lzma-conduit:transformers
25+
, fused-effects-exceptions:transformers
26+
1727
-- the semver package only exposes lens-style accessors for its Version type;
1828
-- normal accessors are in an un-exposed Internal module. on master, the
1929
-- Internal module is exposed, but a new release hasn't been cut to hackage yet
@@ -55,6 +65,6 @@ source-repository-package
5565
source-repository-package
5666
type: git
5767
location: https://github.com/fossas/codec-rpm
58-
tag: 0f7431423d47fdf36945e4ff31fbee76005b7e68
68+
tag: 55e6cc0c0b7906ca257cb7c6268b2d99592bb30f
5969

6070
index-state: hackage.haskell.org 2024-08-14T18:49:08Z

docs/contributing/HACKING.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ On Macs you need to have installed the developer tooling using `xcode-select --i
1414
Use [ghcup][ghcup] to install the `cabal` cli tool and the ghc version we're using:
1515

1616
```sh
17-
$ ghcup install ghc 9.4
17+
$ ghcup install ghc 9.8
1818
<long running output, about 4 min on my machine>
19-
$ ghcup set ghc 9.4
19+
$ ghcup set ghc 9.8
2020
$ cabal update
2121
$ cabal build
2222
```
@@ -29,16 +29,16 @@ In previous GHC versions (8.10), `llvm` was required
2929

3030
Ok, the quickstart worked for you, but why, and how?
3131

32-
> `ghcup install ghc 9.4`
32+
> `ghcup install ghc 9.8`
3333
3434
When you install `ghcup`, `ghc` and `cabal-install` are installed automatically as part of the initial installation (see [Tools](#tools) for descriptions of `ghc` and `cabal-install`).
35-
The `ghc` version that is automatically installed may not be the correct version we use (though it may work just fine). So we install the correct version with `ghcup install ghc 9.4`.
35+
The `ghc` version that is automatically installed may not be the correct version we use (though it may work just fine). So we install the correct version with `ghcup install ghc 9.8`.
3636
Currently, the best place to check the correct version is our CI build files (try `.github/workflows/build.yml`).
3737

38-
> `ghcup set ghc 9.4`
38+
> `ghcup set ghc 9.8`
3939
40-
`ghcup` works by setting symlinks to the "active" version of the tool you're using. Here, we're telling `ghcup` to set GHC 9.4 as the active GHC version.
41-
Now, when you run `ghc`, you'll be running GHC 9.4.
40+
`ghcup` works by setting symlinks to the "active" version of the tool you're using. Here, we're telling `ghcup` to set GHC 9.8 as the active GHC version.
41+
Now, when you run `ghc`, you'll be running GHC 9.8.
4242

4343
> `cabal update`
4444

docs/contributing/STYLE-GUIDE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ If your match guards are any less readable than the introductory examples in
137137
[Learn you a haskell][guards], then you should stick to `case` and `if`
138138
expressions within the function body.
139139

140-
[guards]: http://learnyouahaskell.com/syntax-in-functions#guards-guards
140+
[guards]: https://learnyouahaskell.github.io/syntax-in-functions.html#guards-guards
141141

142142
### Don't go crazy with point-free definitions
143143

spectrometer.cabal

+4-3
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ common lang
7373
-Wall -Wincomplete-uni-patterns -Wcompat
7474
-Wincomplete-record-updates -Wmissing-home-modules
7575
-Wmissing-export-lists -Wredundant-constraints
76+
-Wno-unrecognised-warning-flags
7677

7778
-- TODO: Switch `semver` back to `versions` since https://github.com/fosskers/versions/issues/47 is fixed. This package maintainer seems much more responsive. Contrast https://github.com/brendanhay/semver/issues/12.
7879
-- codec-rpm is installed via cabal.project, so this number is an expected future version.
@@ -104,7 +105,7 @@ common deps
104105
, crypton ^>=1.0.0
105106
, crypton-connection ^>=0.4.1
106107
, data-default-class ^>=0.1.2.0
107-
, deepseq ^>=1.4.8
108+
, deepseq ^>=1.4.8 || ^>=1.5
108109
, direct-sqlite ^>=2.3.27
109110
, directory ^>=1.3.6.1
110111
, either ^>=5.0.2
@@ -124,9 +125,9 @@ common deps
124125
, http-types ^>=0.12.3
125126
, lzma ^>=0.0.1.0
126127
, lzma-conduit ^>=1.2.1
127-
, megaparsec ^>=9.4.0
128+
, megaparsec ^>=9.4 || ^>=9.6
128129
, modern-uri ^>=0.3.6
129-
, mtl ^>=2.2.2
130+
, mtl ^>=2.2 || ^>=2.3
130131
, network ^>=3.1.2.0
131132
, network-uri ^>=2.6.4.0
132133
, optparse-applicative ^>=0.18.0.0

src/App/Fossa/Reachability/Gradle.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Control.Carrier.Reader (Reader, runReader)
1010
import Control.Effect.Diagnostics (Diagnostics, ToDiagnostic, context, errCtx, errHelp, errSupport, renderDiagnostic)
1111
import Control.Effect.Lift (sendIO)
1212
import Control.Effect.Path (withSystemTempDir)
13-
import Control.Monad.List (filterM)
13+
import Control.Monad (filterM)
1414
import Data.ByteString qualified as BS
1515
import Data.ByteString.Lazy qualified as BL
1616
import Data.Error (createErrataWithHeaderOnly)

src/App/Fossa/Reachability/Maven.hs

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import App.Fossa.Reachability.Jar (callGraphFromJars, isValidJar)
77
import App.Fossa.Reachability.Types (CallGraphAnalysis (..))
88
import Control.Carrier.Lift (Lift)
99
import Control.Effect.Diagnostics (Diagnostics, context, fromEither, recover)
10-
import Control.Monad (join)
11-
import Control.Monad.List (filterM)
10+
import Control.Monad (filterM, join)
1211
import Data.Map qualified as Map
1312
import Data.Maybe (catMaybes, fromMaybe)
1413
import Data.String.Conversion (ToText (toText))

src/Control/Effect/Record/TH.hs

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{-# LANGUAGE TemplateHaskell #-}
2+
-- Some partial functions are used safely in this module, so don't warn or error.
3+
{-# OPTIONS_GHC -Wno-x-partial #-}
24

35
module Control.Effect.Record.TH (
46
deriveRecordable,
@@ -51,6 +53,8 @@ conNm (NormalC nm _) = nm
5153
conNm (RecC nm _) = nm
5254
conNm (InfixC _ nm _) = nm
5355
conNm (ForallC _ _ con) = conNm con
56+
-- 'head' is safe here because that field is documented to be non-empty:
57+
-- https://hackage.haskell.org/package/template-haskell-2.22.0.0/docs/Language-Haskell-TH.html#v:GadtC
5458
conNm (GadtC nms _ _) = head nms
5559
conNm (RecGadtC nms _ _) = head nms
5660

src/Control/Effect/Replay/TH.hs

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{-# LANGUAGE TemplateHaskell #-}
2+
-- Some partial functions are used safely in this module.
3+
-- This turns their use into a warning, not an error.
4+
{-# OPTIONS_GHC -Wno-x-partial #-}
25

36
module Control.Effect.Replay.TH (
47
deriveReplayable,
@@ -89,6 +92,8 @@ conNm (NormalC nm _) = nm
8992
conNm (RecC nm _) = nm
9093
conNm (InfixC _ nm _) = nm
9194
conNm (ForallC _ _ con) = conNm con
95+
-- 'head' is safe here because that field is documented to be non-empty:
96+
-- https://hackage.haskell.org/package/template-haskell-2.22.0.0/docs/Language-Haskell-TH.html#v:GadtC
9297
conNm (GadtC nms _ _) = head nms
9398
conNm (RecGadtC nms _ _) = head nms
9499

src/Data/FileEmbed/Extra.hs

+1-3
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ embedFile' fp = runIO logEmbedFile *> embedFile fp
4848
let isRel = isRelative fp
4949
putStrLn $ "Relative?: " <> show isRel
5050

51-
-- `tail` is safe here because `iterate` returns an infinite list and
52-
-- therefore must always have at least 1 element.
53-
let dirs = take (length (splitPath fp) - if isRel then 0 else 1) $ tail $ iterate takeDirectory fp
51+
let dirs = take (length (splitPath fp) - if isRel then 0 else 1) $ drop 1 $ iterate takeDirectory fp
5452
traverse_ ls dirs
5553

5654
ls :: FilePath -> IO ()

src/Data/Rpm/DbHeaderBlob/Internal.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module Data.Rpm.DbHeaderBlob.Internal (
2929
regionTagType,
3030
) where
3131

32-
import Control.Applicative (liftA2)
32+
import Control.Applicative qualified as Ap
3333
import Control.Monad (foldM, replicateM, unless, when)
3434
import Data.Bifunctor (bimap, first)
3535
import Data.Binary.Get (ByteOffset, Get, getInt32be, getWord32be, label, runGetOrFail)
@@ -436,7 +436,7 @@ bsSubString start end = BLS.take (fromIntegral $ end - start) . BLS.drop (fromIn
436436

437437
readEntries :: IndexCount -> Get (NonEmpty EntryMetadata)
438438
readEntries indexLength =
439-
liftA2 (:|) readEntry $ replicateM (fromIntegral (indexLength - 1)) readEntry
439+
Ap.liftA2 (:|) readEntry $ replicateM (fromIntegral (indexLength - 1)) readEntry
440440

441441
readEntry :: Get EntryMetadata
442442
readEntry =

src/Strategy/Cargo.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ parsePkgSpec = eatSpaces (try longSpec <|> simplePkgSpec')
493493
--
494494
-- Package Spec: https://doc.rust-lang.org/cargo/reference/pkgid-spec.html
495495
parsePkgId :: MonadFail m => Text.Text -> m PackageId
496-
parsePkgId t = either fail pure $ oldPkgIdParser' t <|> parseNewSpec
496+
parsePkgId t = either fail pure $ oldPkgIdParser' t <> parseNewSpec
497497
where
498498
oldPkgIdParser' = first toString . oldPkgIdParser
499499

test/App/Fossa/Report/AttributionSpec.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module App.Fossa.Report.AttributionSpec (
33
) where
44

55
import App.Fossa.Report.Attribution
6-
import Control.Applicative (liftA2)
6+
import Control.Applicative qualified as Ap
77
import Data.Aeson
88
import Data.Map.Strict (Map)
99
import Data.Text (Text)
@@ -52,7 +52,7 @@ genAttribution =
5252
<*> Gen.maybe genCopyrightMap
5353

5454
tuplify :: Monad m => m a -> m b -> m (a, b)
55-
tuplify = liftA2 (,)
55+
tuplify = Ap.liftA2 (,)
5656

5757
genLicenseMap :: Gen (Map LicenseName LicenseContents)
5858
genLicenseMap = do

test/Test/Fixtures.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ import App.Fossa.VendoredDependency (VendoredDependency (..))
7070
import App.Types (OverrideDynamicAnalysisBinary (..))
7171
import App.Types qualified as App
7272
import Control.Effect.FossaApiClient qualified as App
73-
import Control.Monad.RWS qualified as Set
7473
import Control.Timeout (Duration (MilliSeconds))
7574
import Data.ByteString.Lazy qualified as LB
7675
import Data.Flag (toFlag)
7776
import Data.List.NonEmpty (NonEmpty)
7877
import Data.List.NonEmpty qualified as NE
7978
import Data.Map.Strict qualified as Map
79+
import Data.Set qualified as Set
8080
import Data.Text (Text)
8181
import Data.Text.Encoding qualified as TL
8282
import Data.Text.Extra (showT)
@@ -511,7 +511,7 @@ vsiOptions :: VSI.VSIModeOptions
511511
vsiOptions =
512512
VSI.VSIModeOptions
513513
{ vsiAnalysisEnabled = toFlag VSI.VSIAnalysis False
514-
, vsiSkipSet = VSI.SkipResolution Set.mempty
514+
, vsiSkipSet = VSI.SkipResolution Set.empty
515515
, iatAssertion = VSI.IATAssertion Nothing
516516
, dynamicLinkingTarget = VSI.DynamicLinkInspect Nothing
517517
, binaryDiscoveryEnabled = toFlag VSI.BinaryDiscovery False

0 commit comments

Comments
 (0)