Skip to content

Commit 6ac5149

Browse files
committed
Upgrade to GHC 9.4
See also: supermario/elm-tooling-compiler#2
1 parent 0f7e122 commit 6ac5149

File tree

10 files changed

+43
-82
lines changed

10 files changed

+43
-82
lines changed

compiler/src/Data/Name.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ fromTypeVariable name@(Utf8.Utf8 ba#) index =
253253
else
254254
let
255255
len# = sizeofByteArray# ba#
256-
end# = indexWord8Array# ba# (len# -# 1#)
256+
end# = word8ToWord# (indexWord8Array# ba# (len# -# 1#))
257257
in
258258
if isTrue# (leWord# 0x30## end#) && isTrue# (leWord# end# 0x39##) then
259259
runST
@@ -328,11 +328,11 @@ fromManyNames names =
328328
ST $ \s ->
329329
case newByteArray# (len# +# 3#) s of
330330
(# s, mba# #) ->
331-
case writeWord8Array# mba# 0# 0x5F## {-_-} s of
331+
case writeWord8Array# mba# 0# (wordToWord8# 0x5F##) {-_-} s of
332332
s ->
333-
case writeWord8Array# mba# 1# 0x4D## {-M-} s of
333+
case writeWord8Array# mba# 1# (wordToWord8# 0x4D##) {-M-} s of
334334
s ->
335-
case writeWord8Array# mba# 2# 0x24## {-$-} s of
335+
case writeWord8Array# mba# 2# (wordToWord8# 0x24##) {-$-} s of
336336
s ->
337337
case copyByteArray# ba# 0# mba# 3# len# s of
338338
s ->

compiler/src/Data/Utf8.hs

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ contains (W8# word#) (Utf8 ba#) =
109109
containsHelp word# ba# 0# (sizeofByteArray# ba#)
110110

111111

112-
containsHelp :: Word# -> ByteArray# -> Int# -> Int# -> Bool
112+
containsHelp :: Word8# -> ByteArray# -> Int# -> Int# -> Bool
113113
containsHelp word# ba# !offset# len# =
114114
if isTrue# (offset# <# len#) then
115-
if isTrue# (eqWord# word# (indexWord8Array# ba# offset#))
115+
if isTrue# (eqWord8# word# (indexWord8Array# ba# offset#))
116116
then True
117117
else containsHelp word# ba# (offset# +# 1#) len#
118118
else
@@ -145,7 +145,7 @@ startsWithChar isGood bytes@(Utf8 ba#) =
145145
False
146146
else
147147
let
148-
!w# = indexWord8Array# ba# 0#
148+
!w# = word8ToWord# (indexWord8Array# ba# 0#)
149149
!char
150150
| isTrue# (ltWord# w# 0xC0##) = C# (chr# (word2Int# w#))
151151
| isTrue# (ltWord# w# 0xE0##) = chr2 ba# 0# w#
@@ -164,7 +164,7 @@ endsWithWord8 (W8# w#) (Utf8 ba#) =
164164
let len# = sizeofByteArray# ba# in
165165
isTrue# (len# ># 0#)
166166
&&
167-
isTrue# (eqWord# w# (indexWord8Array# ba# (len# -# 1#)))
167+
isTrue# (eqWord8# w# (indexWord8Array# ba# (len# -# 1#)))
168168

169169

170170

@@ -186,11 +186,11 @@ splitHelp str start offsets =
186186
unsafeSlice str start offset : splitHelp str (offset + 1) offsets
187187

188188

189-
findDividers :: Word# -> ByteArray# -> Int# -> Int# -> [Int] -> [Int]
189+
findDividers :: Word8# -> ByteArray# -> Int# -> Int# -> [Int] -> [Int]
190190
findDividers divider# ba# !offset# len# revOffsets =
191191
if isTrue# (offset# <# len#) then
192192
findDividers divider# ba# (offset# +# 1#) len# $
193-
if isTrue# (eqWord# divider# (indexWord8Array# ba# offset#))
193+
if isTrue# (eqWord8# divider# (indexWord8Array# ba# offset#))
194194
then I# offset# : revOffsets
195195
else revOffsets
196196
else
@@ -351,7 +351,7 @@ toCharsHelp ba# offset# len# =
351351
[]
352352
else
353353
let
354-
!w# = indexWord8Array# ba# offset#
354+
!w# = word8ToWord# (indexWord8Array# ba# offset#)
355355
!(# char, width# #)
356356
| isTrue# (ltWord# w# 0xC0##) = (# C# (chr# (word2Int# w#)), 1# #)
357357
| isTrue# (ltWord# w# 0xE0##) = (# chr2 ba# offset# w#, 2# #)
@@ -368,7 +368,7 @@ chr2 :: ByteArray# -> Int# -> Word# -> Char
368368
chr2 ba# offset# firstWord# =
369369
let
370370
!i1# = word2Int# firstWord#
371-
!i2# = word2Int# (indexWord8Array# ba# (offset# +# 1#))
371+
!i2# = word8ToInt# (indexWord8Array# ba# (offset# +# 1#))
372372
!c1# = uncheckedIShiftL# (i1# -# 0xC0#) 6#
373373
!c2# = i2# -# 0x80#
374374
in
@@ -380,8 +380,8 @@ chr3 :: ByteArray# -> Int# -> Word# -> Char
380380
chr3 ba# offset# firstWord# =
381381
let
382382
!i1# = word2Int# firstWord#
383-
!i2# = word2Int# (indexWord8Array# ba# (offset# +# 1#))
384-
!i3# = word2Int# (indexWord8Array# ba# (offset# +# 2#))
383+
!i2# = word8ToInt# (indexWord8Array# ba# (offset# +# 1#))
384+
!i3# = word8ToInt# (indexWord8Array# ba# (offset# +# 2#))
385385
!c1# = uncheckedIShiftL# (i1# -# 0xE0#) 12#
386386
!c2# = uncheckedIShiftL# (i2# -# 0x80#) 6#
387387
!c3# = i3# -# 0x80#
@@ -394,9 +394,9 @@ chr4 :: ByteArray# -> Int# -> Word# -> Char
394394
chr4 ba# offset# firstWord# =
395395
let
396396
!i1# = word2Int# firstWord#
397-
!i2# = word2Int# (indexWord8Array# ba# (offset# +# 1#))
398-
!i3# = word2Int# (indexWord8Array# ba# (offset# +# 2#))
399-
!i4# = word2Int# (indexWord8Array# ba# (offset# +# 3#))
397+
!i2# = word8ToInt# (indexWord8Array# ba# (offset# +# 1#))
398+
!i3# = word8ToInt# (indexWord8Array# ba# (offset# +# 2#))
399+
!i4# = word8ToInt# (indexWord8Array# ba# (offset# +# 3#))
400400
!c1# = uncheckedIShiftL# (i1# -# 0xF0#) 18#
401401
!c2# = uncheckedIShiftL# (i2# -# 0x80#) 12#
402402
!c3# = uncheckedIShiftL# (i3# -# 0x80#) 6#
@@ -405,6 +405,10 @@ chr4 ba# offset# firstWord# =
405405
C# (chr# (c1# +# c2# +# c3# +# c4#))
406406

407407

408+
word8ToInt# :: Word8# -> Int#
409+
word8ToInt# word8 =
410+
word2Int# (word8ToWord# word8)
411+
408412

409413
-- TO BUILDER
410414

@@ -471,7 +475,7 @@ toEscapedBuilderHelp before after !name@(Utf8 ba#) k =
471475
escape :: Word8 -> Word8 -> Ptr a -> Utf8 t -> Int -> Int -> Int -> IO ()
472476
escape before@(W8# before#) after ptr name@(Utf8 ba#) offset@(I# offset#) len@(I# len#) i@(I# i#) =
473477
if isTrue# (i# <# len#) then
474-
if isTrue# (eqWord# before# (indexWord8Array# ba# (offset# +# i#)))
478+
if isTrue# (eqWord8# before# (indexWord8Array# ba# (offset# +# i#)))
475479
then
476480
do writeWordToPtr ptr i after
477481
escape before after ptr name offset len (i + 1)

compiler/src/Parse/Variable.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import qualified Data.Name as Name
2121
import qualified Data.Set as Set
2222
import Data.Word (Word8)
2323
import Foreign.Ptr (Ptr, plusPtr)
24-
import GHC.Exts (Char(C#), Int#, (+#), (-#), chr#, uncheckedIShiftL#, word2Int#)
24+
import GHC.Exts (Char(C#), Int#, (+#), (-#), chr#, uncheckedIShiftL#, word2Int#, word8ToWord#)
2525
import GHC.Word (Word8(W8#))
2626

2727
import qualified AST.Source as Src
@@ -384,4 +384,4 @@ chr4 pos firstWord =
384384

385385
unpack :: Word8 -> Int#
386386
unpack (W8# word#) =
387-
word2Int# word#
387+
word2Int# (word8ToWord# word#)

elm.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ Executable lamdera
340340
ansi-wl-pprint >= 0.6.8 && < 0.7,
341341
base >=4.11 && <5,
342342
binary >= 0.8 && < 0.9,
343-
bytestring >= 0.9 && < 0.11,
343+
bytestring >= 0.11.5.2 && < 0.12,
344344
containers,
345345
-- >= 0.5.8.2 && < 0.6,
346346
directory >= 1.2.3.0 && < 2.0,
@@ -350,7 +350,7 @@ Executable lamdera
350350
filepath >= 1 && < 2.0,
351351
ghc-prim >= 0.5.2,
352352
haskeline,
353-
HTTP >= 4000.2.5 && < 4000.4,
353+
HTTP >= 4000.4.1 && < 4000.5,
354354
http-client >= 0.6 && < 0.8,
355355
http-client-tls >= 0.3 && < 0.4,
356356
http-types >= 0.12 && < 1.0,

ext-sentry/Ext/Filewatch.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ watch root action =
3636
Added f _ _ -> f
3737
Modified f _ _ -> f
3838
Removed f _ _ -> f
39-
Unknown f _ _ -> f
39+
Unknown f _ _ _ -> f
4040

4141
-- @TODO it would be better to not listen to these folders in the `watchTree` when available
4242
-- https://github.com/haskell-fswatch/hfsnotify/issues/101

extra/Lamdera/Version.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import qualified Elm.Version as V
99

1010

1111
raw :: (Int, Int, Int)
12-
raw = (1,2,0)
12+
raw = (1,2,1)
1313

1414

1515
rawToString :: (Int, Int, Int) -> String

extra/StandaloneInstances.hs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,6 @@ deriving instance Show Deps.Solver.Details
396396

397397
deriving instance Show Json.Encode.Value
398398

399-
instance Show B.Builder where
400-
show = T.unpack . T.decodeUtf8 . BSL.toStrict . B.toLazyByteString
401-
402399

403400
instance Show Elm.Package.Project where
404401
show = Utf8.toChars

stack.yaml

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
resolver: lts-19.33 # ghc-9.0.2
1+
resolver: lts-21.12 # ghc-9.4.7
22
system-ghc: true
33
allow-newer: true
44
extra-deps:
55
- timeout-0.1.1@sha256:56c1d3321d7139d1f7ebf04d46c95d3a3f1c8c9e0f15666ae3ccd6bae6204b6e,1427
66
- command-0.1.1@sha256:5232b98c195bc3b8a6f35c55ccd2fa424abe355ca54cfcd836bbe7e494834773,1110
77
- snap-server-1.1.2.0@sha256:325378e4f7a50b1a94cf6175e11b9ac6db5edcdd87226f2d5997999334b85c46,15200
88
- websockets-snap-0.10.3.1@sha256:89582b7db916e67b6c8192f489e4eafe7488d9f813e349836a2e74fa4388623d,991
9-
- io-streams-haproxy-1.0.1.0@sha256:2241a754697935e0a11e814affcaa4861b42fe88131f807b586ef48051e28a08,3070
109
# Required to build on windows
1110
- regex-posix-clib-2.7
1211
# elm-format vendoring
@@ -23,13 +22,9 @@ packages:
2322
- '.'
2423

2524

26-
extra-include-dirs: # Try remove this in 9.3.2 as it should be fixed: https://gitlab.haskell.org/ghc/ghc/-/issues/20592#note_436353
27-
# This should be a system agnostic path to macos FFI libs, if not working for you try find a valid with these commands:
28-
# dir=`xcrun --show-sdk-path`/usr/include/ffi && ls -alh $dir && echo $dir
29-
# dir=`pkg-config --cflags libffi | sed -E "s/^-I//"` && ls -alh $dir && echo $dir
30-
- /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi
31-
32-
25+
# Need to re-check if the below is still an issue now we're on GHC 9.4:
26+
# > The system-cxx-std-lib metapackage should significantly improve the status quo here and is shipped with GHC %9.4.1. Closing.
27+
# ---------------
3328
# https://gitlab.haskell.org/ghc/ghc/-/issues/20010#note_359766
3429
# however extra-libraries is not a supported stack.yaml field...?
3530
# extra-libraries: stdc++ supc++ gcc_s
@@ -38,31 +33,3 @@ extra-include-dirs: # Try remove this in 9.3.2 as it should be fixed: https://gi
3833
# https://discourse.haskell.org/t/announce-ghcup-0-1-15-rc2-windows-pre-release/2616/14
3934
# however it seems stack automatically includes a bunch of paths, don't think this helped?
4035
# - C:\ghcup\msys64\mingw64\include
41-
42-
43-
44-
# GHC.Exts has had a change between 9.0.2 and 9.2.4, so need to figure out how to update Utf8:
45-
# https://gist.github.com/supermario/7b103ab79fe6c95bb110d679e4e1a324
46-
# resolver: nightly-2022-11-07 # ghc-9.2.4
47-
# allow-newer: true
48-
# extra-deps:
49-
# - timeout-0.1.1@sha256:56c1d3321d7139d1f7ebf04d46c95d3a3f1c8c9e0f15666ae3ccd6bae6204b6e,1427
50-
# - command-0.1.1@sha256:5232b98c195bc3b8a6f35c55ccd2fa424abe355ca54cfcd836bbe7e494834773,1110
51-
# - snap-server-1.1.2.0@sha256:325378e4f7a50b1a94cf6175e11b9ac6db5edcdd87226f2d5997999334b85c46,15200
52-
# - websockets-snap-0.10.3.1@sha256:89582b7db916e67b6c8192f489e4eafe7488d9f813e349836a2e74fa4388623d,991
53-
# # - io-streams-haproxy-1.0.1.0@sha256:2241a754697935e0a11e814affcaa4861b42fe88131f807b586ef48051e28a08,3070
54-
# - fold-debounce-0.2.0.9@sha256:47353532fdd6ae7b73d935cb583a19516dd7c9a8d306a6276811e0675f45c169,2196
55-
# - snap-core-1.0.5.0@sha256:655c018169185e689ae38f2dc26a9fc3e0c7fd87b7e320bd971a3482bdeb9b91,10019
56-
# - readable-0.3.1@sha256:ea550740bbee9ae46c6bbf1c5e5185818a1d37509b855c640b0a7f2dfba6dc37,1121
57-
# # Required to build on windows
58-
# - regex-posix-clib-2.7
59-
# flags:
60-
# regex-posix:
61-
# _regex-posix-clib: true
62-
# packages:
63-
# - '.'
64-
# extra-include-dirs: # Try remove this in 9.3.2 as it should be fixed: https://gitlab.haskell.org/ghc/ghc/-/issues/20592#note_436353
65-
# # This should be a system agnostic path to macos FFI libs, if not working for you try find a valid with these commands:
66-
# # dir=`xcrun --show-sdk-path`/usr/include/ffi && ls -alh $dir && echo $dir
67-
# # dir=`pkg-config --cflags libffi | sed -E "s/^-I//"` && ls -alh $dir && echo $dir
68-
# - /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi

stack.yaml.lock

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,55 +7,48 @@ packages:
77
- completed:
88
hackage: timeout-0.1.1@sha256:56c1d3321d7139d1f7ebf04d46c95d3a3f1c8c9e0f15666ae3ccd6bae6204b6e,1427
99
pantry-tree:
10-
size: 437
1110
sha256: e571503d7e609c3fe496de7e858613360bfa6c06e20ac57d9659bd32d0645889
11+
size: 437
1212
original:
1313
hackage: timeout-0.1.1@sha256:56c1d3321d7139d1f7ebf04d46c95d3a3f1c8c9e0f15666ae3ccd6bae6204b6e,1427
1414
- completed:
1515
hackage: command-0.1.1@sha256:5232b98c195bc3b8a6f35c55ccd2fa424abe355ca54cfcd836bbe7e494834773,1110
1616
pantry-tree:
17-
size: 167
1817
sha256: 1ecfeb4b1367de6b489dbda20be05df78beb07f71d7c0b1f471fab1cd9c8044a
18+
size: 167
1919
original:
2020
hackage: command-0.1.1@sha256:5232b98c195bc3b8a6f35c55ccd2fa424abe355ca54cfcd836bbe7e494834773,1110
2121
- completed:
2222
hackage: snap-server-1.1.2.0@sha256:325378e4f7a50b1a94cf6175e11b9ac6db5edcdd87226f2d5997999334b85c46,15200
2323
pantry-tree:
24-
size: 3313
2524
sha256: bac856da3319ff93d100dfd5811fbcc39d7d8b7e51d6adc07aea3fc81aacd14e
25+
size: 3313
2626
original:
2727
hackage: snap-server-1.1.2.0@sha256:325378e4f7a50b1a94cf6175e11b9ac6db5edcdd87226f2d5997999334b85c46,15200
2828
- completed:
2929
hackage: websockets-snap-0.10.3.1@sha256:89582b7db916e67b6c8192f489e4eafe7488d9f813e349836a2e74fa4388623d,991
3030
pantry-tree:
31-
size: 330
3231
sha256: 1630fc5df984c0fd574e68860bf21e1ea3f60ffc26ed1f3859d4e5411bc1e6d8
32+
size: 330
3333
original:
3434
hackage: websockets-snap-0.10.3.1@sha256:89582b7db916e67b6c8192f489e4eafe7488d9f813e349836a2e74fa4388623d,991
35-
- completed:
36-
hackage: io-streams-haproxy-1.0.1.0@sha256:2241a754697935e0a11e814affcaa4861b42fe88131f807b586ef48051e28a08,3070
37-
pantry-tree:
38-
size: 589
39-
sha256: e0fd63710948210cda2b5d21bd51eedc43f8813470d015158de8bd03237b1cb9
40-
original:
41-
hackage: io-streams-haproxy-1.0.1.0@sha256:2241a754697935e0a11e814affcaa4861b42fe88131f807b586ef48051e28a08,3070
4235
- completed:
4336
hackage: regex-posix-clib-2.7@sha256:998fca06da3d719818f0691ef0b8b9b7375afeea228cb08bd9e2db53f96b0cd7,1232
4437
pantry-tree:
45-
size: 524
4638
sha256: 5bf20952472d930323766d250f5fbbe3fe6f2cd3d931e5cf7b62a238ab2099ff
39+
size: 524
4740
original:
4841
hackage: regex-posix-clib-2.7
4942
- completed:
5043
hackage: ansi-terminal-0.11@sha256:97470250c92aae14c4c810d7f664c532995ba8910e2ad797b29f22ad0d2d0194,3307
5144
pantry-tree:
52-
size: 1461
5345
sha256: 4098c4b8bb503fcf0730aedc8247a479d3e22fd1fe4c6b4b2b2b5da30bdfb713
46+
size: 1461
5447
original:
5548
hackage: ansi-terminal-0.11
5649
snapshots:
5750
- completed:
58-
size: 619204
59-
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/33.yaml
60-
sha256: 6d1532d40621957a25bad5195bfca7938e8a06d923c91bc52aa0f3c41181f2d4
61-
original: lts-19.33
51+
sha256: 9313df78f49519315342f4c51ffc5da12659d3735f8ac3c54a1fb98ff874474e
52+
size: 640036
53+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/12.yaml
54+
original: lts-21.12

vendor/elm-format

Submodule elm-format updated 118 files

0 commit comments

Comments
 (0)