Skip to content

Commit 93dd776

Browse files
committed
Fix formatting and upgrade to ormolu 0.7.5 (to support TypeAbstractions)
1 parent 5a1667f commit 93dd776

File tree

8 files changed

+112
-58
lines changed

8 files changed

+112
-58
lines changed

examples-version-changes/ghc-dps-compact/after/Compact/BFTraversal.hs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
{-# LANGUAGE PatternSynonyms #-}
1212
{-# LANGUAGE RankNTypes #-}
1313
{-# LANGUAGE ScopedTypeVariables #-}
14+
{-# LANGUAGE TypeAbstractions #-}
1415
{-# LANGUAGE TypeApplications #-}
1516
{-# LANGUAGE UnicodeSyntax #-}
1617
{-# LANGUAGE NoImplicitPrelude #-}
17-
{-# LANGUAGE TypeAbstractions #-}
1818
{-# OPTIONS_GHC -Wno-name-shadowing #-}
1919
{-# OPTIONS_GHC -ddump-simpl -ddump-to-file -dsuppress-all #-}
2020

@@ -83,11 +83,14 @@ mapPhasesBFS f = runPhases NonLin.. bft' f
8383

8484
mapAccumBFS :: forall a b s. (s -> a -> (s, b)) -> s -> BinTree a -> (BinTree b, s)
8585
mapAccumBFS f s0 tree =
86-
unur (withRegion (
87-
\ @r token ->
88-
fromIncomplete $
89-
alloc @r token
90-
<&> \dtree -> go s0 (singletonN (Ur tree, dtree))))
86+
unur
87+
( withRegion
88+
( \ @r token ->
89+
fromIncomplete $
90+
alloc @r token
91+
<&> \dtree -> go s0 (singletonN (Ur tree, dtree))
92+
)
93+
)
9194
where
9295
go :: forall r. (Region r) => s -> NaiveQueue (Ur (BinTree a), Dest r (BinTree b)) %1 -> Ur s
9396
go s q = case dequeueN q of

examples-version-changes/ghc-dps-compact/after/Compact/DList.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
{-# LANGUAGE LinearTypes #-}
88
{-# LANGUAGE RankNTypes #-}
99
{-# LANGUAGE ScopedTypeVariables #-}
10+
{-# LANGUAGE TypeAbstractions #-}
1011
{-# LANGUAGE TypeApplications #-}
1112
{-# LANGUAGE NoImplicitPrelude #-}
12-
{-# LANGUAGE TypeAbstractions #-}
1313
{-# OPTIONS_GHC -Wno-name-shadowing -Wno-type-defaults #-}
1414
{-# OPTIONS_GHC -ddump-simpl -ddump-to-file -dsuppress-all #-}
1515

examples-version-changes/ghc-dps-compact/after/Compact/Map.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
{-# LANGUAGE RankNTypes #-}
99
{-# LANGUAGE ScopedTypeVariables #-}
1010
{-# LANGUAGE TupleSections #-}
11+
{-# LANGUAGE TypeAbstractions #-}
1112
{-# LANGUAGE TypeApplications #-}
1213
{-# LANGUAGE NoImplicitPrelude #-}
13-
{-# LANGUAGE TypeAbstractions #-}
1414
{-# OPTIONS_GHC -Wno-name-shadowing -Wno-type-defaults #-}
1515
{-# OPTIONS_GHC -ddump-simpl -ddump-to-file -dsuppress-all #-}
1616

examples-version-changes/ghc-dps-compact/after/Compact/Queue.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
{-# LANGUAGE LinearTypes #-}
88
{-# LANGUAGE RankNTypes #-}
99
{-# LANGUAGE ScopedTypeVariables #-}
10+
{-# LANGUAGE TypeAbstractions #-}
1011
{-# LANGUAGE TypeApplications #-}
1112
{-# LANGUAGE NoImplicitPrelude #-}
12-
{-# LANGUAGE TypeAbstractions #-}
1313
{-# OPTIONS_GHC -Wno-name-shadowing -Wno-type-defaults #-}
1414
{-# OPTIONS_GHC -ddump-simpl -ddump-to-file -dsuppress-all #-}
1515

examples-version-changes/ghc-dps-compact/after/Compact/SExpr.hs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
{-# LANGUAGE MultiWayIf #-}
1010
{-# LANGUAGE PatternGuards #-}
1111
{-# LANGUAGE ScopedTypeVariables #-}
12+
{-# LANGUAGE TypeAbstractions #-}
1213
{-# LANGUAGE TypeApplications #-}
1314
{-# LANGUAGE NoImplicitPrelude #-}
14-
{-# LANGUAGE TypeAbstractions #-}
1515
{-# OPTIONS_GHC -Wno-name-shadowing #-}
1616
{-# OPTIONS_GHC -ddump-simpl -ddump-to-file -dsuppress-all #-}
1717

@@ -212,11 +212,13 @@ parseWithoutDest bs = case parseWithoutDest' bs 0 of
212212
parseWithDest :: ByteString -> Either SExprParseError SExpr
213213
parseWithDest bs =
214214
let Ur (sexpr, res) =
215-
withRegion (\ @r token ->
216-
fromIncomplete $
217-
alloc @r token
218-
<&> \d ->
219-
move $ parseWithDest' bs 0 d)
215+
withRegion
216+
( \ @r token ->
217+
fromIncomplete $
218+
alloc @r token
219+
<&> \d ->
220+
move $ parseWithDest' bs 0 d
221+
)
220222
in case res of
221223
Left err -> Left err
222224
Right i ->

stack.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@ resolver: lts-22.34
22
packages:
33
- '.'
44
extra-deps:
5+
- ormolu-0.7.5.0
6+
- Cabal-syntax-3.12.1.0@sha256:6dbb06fb08ff77520947fb4c1ef281c9cea5b8dc7fd9a41ad62273fa916cf4b2,7407
7+
- ghc-lib-parser-9.10.1.20240511@sha256:8bf3d512642fae8b38a119d0f440dc02477bed8520a5f3cd814a765505f80d76,17528
8+
- text-2.1.1@sha256:78c3fb91055d0607a80453327f087b9dc82168d41d0dca3ff410d21033b5e87d,10653
9+
- parsec-3.1.17.0@sha256:8407cbd428d7f640a0fff8891bd2f7aca13cebe70a5e654856f8abec9a648b56,5149

stack.yaml.lock

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,42 @@
33
# For more information, please see the documentation at:
44
# https://docs.haskellstack.org/en/stable/lock_files
55

6-
packages: []
6+
packages:
7+
- completed:
8+
hackage: ormolu-0.7.5.0@sha256:7f56ba2fde3291ac9ad8c77c4f027e247ff57deff1f5675d9c2cb5dd993d51c9,5774
9+
pantry-tree:
10+
sha256: 6256bb00b3fef0c68ea67829ace5d05483e200ade6b223af6da3ea1b76047899
11+
size: 100728
12+
original:
13+
hackage: ormolu-0.7.5.0
14+
- completed:
15+
hackage: Cabal-syntax-3.12.1.0@sha256:6dbb06fb08ff77520947fb4c1ef281c9cea5b8dc7fd9a41ad62273fa916cf4b2,7407
16+
pantry-tree:
17+
sha256: 62e4b1bbdf7fe7d5259f45811e6fd0131823a10a8ec8c5eaf25370d444ac263a
18+
size: 11051
19+
original:
20+
hackage: Cabal-syntax-3.12.1.0@sha256:6dbb06fb08ff77520947fb4c1ef281c9cea5b8dc7fd9a41ad62273fa916cf4b2,7407
21+
- completed:
22+
hackage: ghc-lib-parser-9.10.1.20240511@sha256:8bf3d512642fae8b38a119d0f440dc02477bed8520a5f3cd814a765505f80d76,17528
23+
pantry-tree:
24+
sha256: 1f1f9f83ac6e326fec01a46a5f3c3991d84a3d254e4ed6e0e84d84f92f12e30a
25+
size: 37484
26+
original:
27+
hackage: ghc-lib-parser-9.10.1.20240511@sha256:8bf3d512642fae8b38a119d0f440dc02477bed8520a5f3cd814a765505f80d76,17528
28+
- completed:
29+
hackage: text-2.1.1@sha256:78c3fb91055d0607a80453327f087b9dc82168d41d0dca3ff410d21033b5e87d,10653
30+
pantry-tree:
31+
sha256: 8251d517ceafa2680250ddb939f4a2b89bf231314cf6a218134af900e154d7cd
32+
size: 8413
33+
original:
34+
hackage: text-2.1.1@sha256:78c3fb91055d0607a80453327f087b9dc82168d41d0dca3ff410d21033b5e87d,10653
35+
- completed:
36+
hackage: parsec-3.1.17.0@sha256:8407cbd428d7f640a0fff8891bd2f7aca13cebe70a5e654856f8abec9a648b56,5149
37+
pantry-tree:
38+
sha256: 0922d72bd7115bbb590757bd92a827021dfe745ed6c0cd22856f767bee83d91f
39+
size: 2810
40+
original:
41+
hackage: parsec-3.1.17.0@sha256:8407cbd428d7f640a0fff8891bd2f7aca13cebe70a5e654856f8abec9a648b56,5149
742
snapshots:
843
- completed:
944
sha256: edbd50d7e7c85c13ad5f5835ae2db92fab1e9cf05ecf85340e2622ec0a303df1

test-version-changes/ghc-dps-compact/after/Test/Compact/Destination.hs

Lines changed: 51 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
{-# LANGUAGE MagicHash #-}
1111
{-# LANGUAGE RankNTypes #-}
1212
{-# LANGUAGE ScopedTypeVariables #-}
13+
{-# LANGUAGE TypeAbstractions #-}
1314
{-# LANGUAGE TypeApplications #-}
1415
{-# LANGUAGE NoImplicitPrelude #-}
15-
{-# LANGUAGE TypeAbstractions #-}
1616

1717
module Test.Compact.Destination (destinationTests) where
1818

@@ -39,19 +39,22 @@ data Foo a b = MkFoo {unBar :: a, unBaz :: (b, b), unBoo :: a} deriving (Eq, Gen
3939
compOnFreshAlloc :: IO String
4040
compOnFreshAlloc = do
4141
let actual :: Ur (Int, Int)
42-
!actual = withRegion (\ @r t -> case dup2 t of
43-
(t', t'') ->
44-
fromIncomplete_ $
45-
(alloc @r t')
46-
<&> ( \dp ->
47-
case (dp & fill @'(,)) of
48-
(dl, dr) ->
49-
dl
50-
& fillLeaf 1
51-
`lseq` dr
52-
& fillComp (alloc @r t'')
53-
& fillLeaf 2
54-
))
42+
!actual =
43+
withRegion
44+
( \ @r t -> case dup2 t of
45+
(t', t'') ->
46+
fromIncomplete_ $
47+
(alloc @r t')
48+
<&> ( \dp ->
49+
case (dp & fill @'(,)) of
50+
(dl, dr) ->
51+
dl
52+
& fillLeaf 1
53+
`lseq` dr
54+
& fillComp (alloc @r t'')
55+
& fillLeaf 2
56+
)
57+
)
5558
expected :: Ur (Int, Int)
5659
!expected = Ur (1, 2)
5760
assertEqual "same result" expected actual
@@ -60,19 +63,22 @@ compOnFreshAlloc = do
6063
compOnUsedAlloc :: IO String
6164
compOnUsedAlloc = do
6265
let actual :: Ur (Int, (Int, Int))
63-
!actual = withRegion (\ @r t -> case dup2 t of
64-
(t', t'') ->
65-
fromIncomplete_ $
66-
(alloc @r t')
67-
<&> ( \dp ->
68-
case dp & fill @'(,) of
69-
(dl, dr) ->
70-
dl
71-
& fillLeaf 1
72-
`lseq` dr
73-
& fillComp ((alloc @r t'') <&> (\dp' -> case dp' & fill @'(,) of (dr1, dr2) -> dr1 & fillLeaf 2 `lseq` dr2))
74-
& fillLeaf 3
75-
))
66+
!actual =
67+
withRegion
68+
( \ @r t -> case dup2 t of
69+
(t', t'') ->
70+
fromIncomplete_ $
71+
(alloc @r t')
72+
<&> ( \dp ->
73+
case dp & fill @'(,) of
74+
(dl, dr) ->
75+
dl
76+
& fillLeaf 1
77+
`lseq` dr
78+
& fillComp ((alloc @r t'') <&> (\dp' -> case dp' & fill @'(,) of (dr1, dr2) -> dr1 & fillLeaf 2 `lseq` dr2))
79+
& fillLeaf 3
80+
)
81+
)
7682
expected :: Ur (Int, (Int, Int))
7783
!expected = Ur (1, (2, 3))
7884
assertEqual "same result" expected actual
@@ -81,21 +87,24 @@ compOnUsedAlloc = do
8187
fillCustomDataAndExtract :: IO String
8288
fillCustomDataAndExtract = do
8389
let actual :: Ur (Foo Int Char, Int)
84-
!actual = withRegion (\ @r t ->
85-
fromIncomplete $
86-
(alloc @r t)
87-
<&> ( \d ->
88-
case d & fill @'MkFoo of
89-
(dBar, dBaz, dBoo) ->
90-
dBar
91-
& fillLeaf 1
92-
`lseq` ( case dBaz & fill @'(,) of
93-
(dl, dr) -> dl & fillLeaf 'a' `lseq` dr & fillLeaf 'b'
94-
)
95-
`lseq` dBoo
96-
& fillLeaf 2
97-
`lseq` Ur 14
98-
))
90+
!actual =
91+
withRegion
92+
( \ @r t ->
93+
fromIncomplete $
94+
(alloc @r t)
95+
<&> ( \d ->
96+
case d & fill @'MkFoo of
97+
(dBar, dBaz, dBoo) ->
98+
dBar
99+
& fillLeaf 1
100+
`lseq` ( case dBaz & fill @'(,) of
101+
(dl, dr) -> dl & fillLeaf 'a' `lseq` dr & fillLeaf 'b'
102+
)
103+
`lseq` dBoo
104+
& fillLeaf 2
105+
`lseq` Ur 14
106+
)
107+
)
99108
expected :: Ur (Foo Int Char, Int)
100109
!expected = Ur (MkFoo 1 ('a', 'b') 2, 14)
101110
assertEqual "same result" expected actual

0 commit comments

Comments
 (0)