Skip to content

Commit 377bdbd

Browse files
authored
Upgrade to GHC 9.8.4 (purescript#4574)
* Use latest HLint version in CI workflow * Upgrade to latest version of Cheapskate * Allow newer deps for weeder * Use `NonEmpty String` for `directiveStrings`
1 parent 48be80d commit 377bdbd

27 files changed

Lines changed: 259 additions & 136 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ jobs:
5454
fail-fast: false # do not cancel builds for other OSes if one fails
5555
matrix:
5656
include:
57-
- image: haskell:9.6.6 # Also upgrade version in the lint job below
57+
- image: haskell:9.8.4 # Also upgrade version in the lint job below
5858
os: ubuntu-latest # Exact version is not important, as it's only the container host)
5959

60-
- image: haskell:9.6.6
60+
- image: haskell:9.8.4
6161
os: ubuntu-24.04-arm # Exact version is not important, as it's only the container host
6262

6363
- os: macos-13 # x64
@@ -92,7 +92,7 @@ jobs:
9292
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'windows')
9393
uses: "haskell-actions/setup@v2"
9494
with:
95-
ghc-version: "9.6.6"
95+
ghc-version: "9.8.4"
9696
enable-stack: true
9797
stack-version: "${{ env.STACK_VERSION }}"
9898
stack-no-global: true
@@ -202,7 +202,7 @@ jobs:
202202
run: "gh release upload --clobber ${{ github.ref_name }} sdist-test/bundle/*.{tar.gz,sha}"
203203

204204
lint:
205-
container: haskell:9.6.6
205+
container: haskell:9.8.4
206206
runs-on: ubuntu-latest # Exact version is not important, as it's only the container host
207207

208208
steps:
@@ -220,7 +220,7 @@ jobs:
220220

221221
- run: "ci/fix-home ci/run-hlint.sh --git"
222222
env:
223-
VERSION: "3.5"
223+
VERSION: "3.10"
224224

225225
- name: Install weeder
226226
run: |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* Upgrade GHC to [`9.8.4`](https://downloads.haskell.org/~ghc/9.8.4/docs/users_guide/9.8.4-notes.html), Stackage LTS `23.18`
2+
* Use [HLint 3.10](https://github.com/ndmitchell/hlint/blob/master/CHANGES.txt) in CI

INSTALL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ If you are having difficulty installing the PureScript compiler, feel free to as
44

55
## Requirements
66

7-
The PureScript compiler is built using GHC 9.6.6, and should be able to run on any operating system supported by GHC 9.6.6.
7+
The PureScript compiler is built using GHC 9.8.4, and should be able to run on any operating system supported by GHC 9.8.4.
88
In particular:
99

1010
* for Windows users, versions predating Vista are not officially supported,
1111
* for macOS / OS X users, versions predating Mac OS X 10.7 (Lion) are not officially supported.
1212

13-
See also <https://www.haskell.org/ghc/download_ghc_9_6_6.html> for more details about the operating systems which GHC 9.6.6 supports.
13+
See also <https://www.haskell.org/ghc/download_ghc_9_8_4.html> for more details about the operating systems which GHC 9.8.4 supports.
1414

1515
## Official prebuilt binaries
1616

cabal.project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ packages:
44
source-repository-package
55
type: git
66
location: https://github.com/purescript/cheapskate.git
7-
tag: 8bfaf4beeb108e97a274ed51303f278905979e87
7+
tag: 633c69024e061ad956f1aecfc137fb99a7a7a20b

purescript.cabal

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ common defaults
8686
-Wno-missing-export-lists
8787
-Wno-missing-kind-signatures
8888
-Wno-partial-fields
89+
-Wno-missing-role-annotations
8990
default-language: Haskell2010
9091
default-extensions:
9192
BangPatterns
@@ -118,8 +119,6 @@ common defaults
118119
TupleSections
119120
TypeFamilies
120121
ViewPatterns
121-
build-tool-depends:
122-
happy:happy ==1.20.1.1
123122
build-depends:
124123
-- NOTE: Please do not edit these version constraints manually. They are
125124
-- deliberately made narrow because changing the dependency versions in
@@ -153,61 +152,61 @@ common defaults
153152
-- modules must be parseable by this library otherwise the compiler
154153
-- will reject them. It should therefore always be pinned to a single
155154
-- specific version.
156-
aeson >=2.0.3.0 && <2.2,
155+
aeson >=2.2.3.0 && <2.3,
157156
aeson-better-errors >=0.9.1.3 && <0.10,
158-
ansi-terminal >=0.11.3 && <1.1,
159-
array >=0.5.4.0 && <0.6,
160-
base >=4.16.2.0 && <4.19,
161-
blaze-html >=0.9.1.2 && <0.10,
157+
ansi-terminal >=1.1.2 && <1.2,
158+
array >=0.5.8.0 && <0.6,
159+
base >=4.19.2.0 && <4.20,
160+
blaze-html >=0.9.2.0 && <0.10,
162161
bower-json >=1.1.0.0 && <1.2,
163162
boxes >=0.1.5 && <0.2,
164-
bytestring >=0.11.3.1 && <0.12,
163+
bytestring >=0.12.1.0 && <0.13,
165164
Cabal >=3.10.3.0 && <3.11,
166-
cborg >=0.2.7.0 && <0.3,
165+
cborg >=0.2.10.0 && <0.3,
167166
cheapskate >=0.1.1.2 && <0.2,
168-
clock >=0.8.3 && <0.9,
169-
containers >=0.6.5.1 && <0.7,
170-
cryptonite ==0.30.*,
167+
clock >=0.8.4 && <0.9,
168+
containers >=0.6.8 && <0.7,
169+
cryptonite >=0.30 && <0.31,
171170
data-ordlist >=0.4.7.0 && <0.5,
172-
deepseq >=1.4.6.1 && <1.5,
173-
directory >=1.3.6.2 && <1.4,
174-
dlist ==1.0.*,
171+
deepseq >=1.5.1.0 && <1.6,
172+
directory >=1.3.8.5 && <1.4,
173+
dlist >=1.0 && <1.1,
175174
edit-distance >=0.2.2.1 && <0.3,
176-
file-embed >=0.0.15.0 && <0.1,
177-
filepath >=1.4.2.2 && <1.5,
175+
file-embed >=0.0.16.0 && <0.1,
176+
filepath >=1.4.301.0 && <1.5,
178177
Glob >=0.10.2 && <0.11,
179178
haskeline ==0.8.2,
180179
language-javascript ==0.7.0.0,
181-
lens >=5.1.1 && <5.3,
182-
lifted-async >=0.10.2.2 && <0.11,
180+
lens >=5.3.4 && <5.4,
181+
lifted-async >=0.10.2.7 && <0.11,
183182
lifted-base >=0.2.3.12 && <0.3,
184-
memory >=0.17.0 && <0.19,
183+
memory >=0.18.0 && <0.19,
185184
monad-control >=1.0.3.1 && <1.1,
186-
monad-logger >=0.3.36 && <0.4,
187-
monoidal-containers >=0.6.2.0 && <0.7,
188-
mtl >=2.2.2 && <2.4,
185+
monad-logger >=0.3.42 && <0.4,
186+
monoidal-containers >=0.6.6.0 && <0.7,
187+
mtl >=2.3.1 && <2.4,
189188
parallel >=3.2.2.0 && <3.3,
190-
parsec >=3.1.15.0 && <3.2,
191-
process >=1.6.19.0 && <1.7,
192-
protolude >=0.3.1 && <0.4,
193-
regex-tdfa >=1.3.1.2 && <1.4,
194-
safe >=0.3.19 && <0.4,
195-
scientific >=0.3.7.0 && <0.4,
196-
semialign >=1.2.0.1 && <1.4,
197-
semigroups ==0.20.*,
198-
serialise >=0.2.5.0 && <0.3,
189+
parsec >=3.1.17.0 && <3.2,
190+
process >=1.6.25.0 && <1.7,
191+
protolude >=0.3.4 && <0.4,
192+
regex-tdfa >=1.3.2.3 && <1.4,
193+
safe >=0.3.21 && <0.4,
194+
scientific >=0.3.8.0 && <0.4,
195+
semialign >=1.3.1 && <1.4,
196+
semigroups >=0.20 && <0.21,
197+
serialise >=0.2.6.1 && <0.3,
199198
sourcemap >=0.1.7 && <0.2,
200-
stm >=2.5.0.2 && <2.6,
199+
stm >=2.5.3.1 && <2.6,
201200
stringsearch >=0.3.6.6 && <0.4,
202-
template-haskell >=2.18.0.0 && <2.21,
203-
text >=1.2.5.0 && <2.1,
204-
these >=1.1.1.1 && <1.3,
205-
time >=1.11.1.1 && <1.13,
206-
transformers >=0.5.6.2 && <0.7,
201+
template-haskell >=2.21.0.0 && <2.22,
202+
text >=2.1.1 && <2.2,
203+
these >=1.2.1 && <1.3,
204+
time >=1.12.2 && <1.13,
205+
transformers >=0.6.1.0 && <0.7,
207206
transformers-base >=0.4.6 && <0.5,
208207
utf8-string >=1.0.2 && <1.1,
209-
vector >=0.12.3.1 && <0.14,
210-
witherable >=0.4.2 && <0.5,
208+
vector >=0.13.2.0 && <0.14,
209+
witherable >=0.5 && <0.6,
211210

212211
library
213212
import: defaults
@@ -403,17 +402,17 @@ executable purs
403402
main-is: Main.hs
404403
ghc-options: -fno-warn-unused-do-bind -threaded -rtsopts -with-rtsopts=-N -Wno-unused-packages
405404
build-depends:
406-
prettyprinter >=1.6 && <1.8,
407-
prettyprinter-ansi-terminal >=1.1.1 && <1.2,
408-
exceptions >=0.10.4 && <0.11,
409-
network >=3.1.2.7 && <3.2,
410-
optparse-applicative >=0.17.0.0 && <0.19,
405+
prettyprinter >=1.7.1 && <1.8,
406+
prettyprinter-ansi-terminal >=1.1.3 && <1.2,
407+
exceptions >=0.10.7 && <0.11,
408+
network >=3.2.7.0 && <3.3,
409+
optparse-applicative >=0.18.1.0 && <0.19,
411410
purescript
412411
if flag(release)
413412
cpp-options: -DRELEASE
414413
else
415414
build-depends:
416-
gitrev >=1.2.0 && <1.4
415+
gitrev >=1.3.1 && <1.4,
417416
other-modules:
418417
Command.Bundle
419418
Command.Compile
@@ -441,13 +440,13 @@ test-suite tests
441440
build-depends:
442441
purescript,
443442
generic-random >=1.5.0.1 && <1.6,
444-
hspec >= 2.11.10 && < 3,
443+
hspec >=2.11.12 && <2.12,
445444
HUnit >=1.6.2.0 && <1.7,
446445
newtype >=0.2.2.0 && <0.3,
447-
QuickCheck >=2.14.2 && <2.15,
448-
regex-base >=0.94.0.2 && <0.95,
449-
split >=0.2.3.4 && <0.3,
450-
typed-process >=0.2.10.1 && <0.3
446+
QuickCheck >=2.14.3 && <2.15,
447+
regex-base >=0.94.0.3 && <0.95,
448+
split >=0.2.5 && <0.3,
449+
typed-process >=0.2.12.0 && <0.3,
451450
build-tool-depends:
452451
hspec-discover:hspec-discover -any
453452
-- we need the compiler's executable available for the ide tests
@@ -472,6 +471,7 @@ test-suite tests
472471
TestGraph
473472
TestHierarchy
474473
TestIde
474+
TestInteractive
475475
TestMake
476476
TestPrimDocs
477477
TestPsci

src/Language/PureScript/CST/Convert.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module Language.PureScript.CST.Convert
1616
) where
1717

1818
import Prelude hiding (take)
19+
import Protolude (headDef)
1920

2021
import Data.Bifunctor (bimap, first)
2122
import Data.Char (toLower)
@@ -446,7 +447,7 @@ convertDeclaration :: String -> Declaration a -> [AST.Declaration]
446447
convertDeclaration fileName decl = case decl of
447448
DeclData _ (DataHead _ a vars) bd -> do
448449
let
449-
ctrs :: SourceToken -> DataCtor a -> [(SourceToken, DataCtor a)] -> [AST.DataConstructorDeclaration]
450+
ctrs :: SourceToken -> DataCtor b -> [(SourceToken, DataCtor b)] -> [AST.DataConstructorDeclaration]
450451
ctrs st (DataCtor _ name fields) tl
451452
= AST.DataConstructorDeclaration (sourceAnnCommented fileName st (nameTok name)) (nameValue name) (zip ctrFields $ convertType fileName <$> fields)
452453
: (case tl of
@@ -460,7 +461,7 @@ convertDeclaration fileName decl = case decl of
460461
(goTypeVar <$> vars)
461462
(convertType fileName bd)
462463
DeclNewtype _ (DataHead _ a vars) st x ys -> do
463-
let ctrs = [AST.DataConstructorDeclaration (sourceAnnCommented fileName st (snd $ declRange decl)) (nameValue x) [(head ctrFields, convertType fileName ys)]]
464+
let ctrs = [AST.DataConstructorDeclaration (sourceAnnCommented fileName st (snd $ declRange decl)) (nameValue x) [(headDef (internalError "No constructor name") ctrFields, convertType fileName ys)]]
464465
pure $ AST.DataDeclaration ann Env.Newtype (nameValue a) (goTypeVar <$> vars) ctrs
465466
DeclClass _ (ClassHead _ sup name vars fdeps) bd -> do
466467
let

src/Language/PureScript/CST/Monad.hs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,11 @@ mkParserError stack toks ty =
102102
, errType = ty
103103
}
104104
where
105-
range = case toks of
106-
[] -> SourceRange (SourcePos 0 0) (SourcePos 0 0)
107-
_ -> widen (tokRange . tokAnn $ head toks) (tokRange . tokAnn $ last toks)
105+
range = case NE.nonEmpty toks of
106+
Nothing -> SourceRange (SourcePos 0 0) (SourcePos 0 0)
107+
Just neToks -> widen
108+
(tokRange . tokAnn $ NE.head neToks)
109+
(tokRange . tokAnn $ NE.last neToks)
108110

109111
addFailure :: [SourceToken] -> ParserErrorType -> Parser ()
110112
addFailure toks ty = Parser $ \st _ ksucc ->

src/Language/PureScript/CST/Utils.hs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module Language.PureScript.CST.Utils where
22

33
import Prelude
4+
import Protolude (headDef)
45

56
import Control.Monad (unless)
67
import Data.Coerce (coerce)
@@ -86,16 +87,20 @@ unexpectedLabel :: SourceToken -> Label
8687
unexpectedLabel tok = Label tok "<unexpected>"
8788

8889
unexpectedExpr :: Monoid a => [SourceToken] -> Expr a
89-
unexpectedExpr toks = ExprIdent mempty (unexpectedQual (head toks))
90+
unexpectedExpr toks =
91+
ExprIdent mempty (unexpectedQual (headDef placeholder toks))
9092

9193
unexpectedBinder :: Monoid a => [SourceToken] -> Binder a
92-
unexpectedBinder toks = BinderVar mempty (unexpectedName (head toks))
94+
unexpectedBinder toks =
95+
BinderVar mempty (unexpectedName (headDef placeholder toks))
9396

9497
unexpectedRecordUpdate :: Monoid a => [SourceToken] -> RecordUpdate a
95-
unexpectedRecordUpdate toks = RecordUpdateLeaf (unexpectedLabel (head toks)) (head toks) (unexpectedExpr toks)
98+
unexpectedRecordUpdate toks =
99+
RecordUpdateLeaf (unexpectedLabel (headDef placeholder toks)) (headDef placeholder toks) (unexpectedExpr toks)
96100

97101
unexpectedRecordLabeled :: [SourceToken] -> RecordLabeled a
98-
unexpectedRecordLabeled toks = RecordPun (unexpectedName (head toks))
102+
unexpectedRecordLabeled toks =
103+
RecordPun (unexpectedName (headDef placeholder toks))
99104

100105
rangeToks :: TokenRange -> [SourceToken]
101106
rangeToks (a, b) = [a, b]

src/Language/PureScript/CodeGen/JS.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module Language.PureScript.CodeGen.JS
77
) where
88

99
import Prelude
10-
import Protolude (ordNub)
10+
import Protolude (ordNub, headDef)
1111

1212
import Control.Monad (forM, replicateM, void)
1313
import Control.Monad.Except (MonadError, throwError)
@@ -310,7 +310,8 @@ moduleBindToJs mn = bindToJs
310310
let (f, args) = unApp e []
311311
args' <- mapM valueToJs args
312312
case f of
313-
Var (_, _, Just IsNewtype) _ -> return (head args')
313+
Var (_, _, Just IsNewtype) _ ->
314+
return (headDef (internalError "Newtype constructor without constructor name") args')
314315
Var (_, _, Just (IsConstructor _ fields)) name | length args == length fields ->
315316
return $ AST.Unary Nothing AST.New $ AST.App Nothing (qualifiedToJS id name) args'
316317
_ -> flip (foldl (\fn a -> AST.App Nothing fn [a])) args' <$> valueToJs f

src/Language/PureScript/CoreImp/Optimizer/TCO.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import Prelude
55

66
import Control.Applicative (empty)
77
import Control.Monad (guard)
8-
import Control.Monad.State (State, evalState, get, modify)
9-
import Data.Functor (($>), (<&>))
8+
import Control.Monad.State (State, evalState, gets, modify)
9+
import Data.Functor (($>))
1010
import Data.Set qualified as S
1111
import Data.Text (Text, pack)
1212
import Language.PureScript.CoreImp.AST (AST(..), InitializerEffects(..), UnaryOperator(..), everything, everywhereTopDownM)
@@ -23,7 +23,7 @@ tco = flip evalState 0 . everywhereTopDownM convert where
2323
copyVar arg = "$copy_" <> arg
2424

2525
tcoDoneM :: State Int Text
26-
tcoDoneM = get <&> \count -> "$tco_done" <>
26+
tcoDoneM = gets $ \count -> "$tco_done" <>
2727
if count == 0 then "" else pack . show $ count
2828

2929
tcoLoop :: Text

0 commit comments

Comments
 (0)