Skip to content

Commit a822200

Browse files
authored
Merge pull request #883 from argotorg/ghc-910
Fix GHC 9.10 warnings
2 parents 95b5e07 + a10c3df commit a822200

File tree

10 files changed

+42
-28
lines changed

10 files changed

+42
-28
lines changed

hevm.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ executable hevm
219219
witch,
220220
unliftio-core,
221221
split,
222-
wreq,
223222

224223
--- Test Helpers ---
225224

src/EVM.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
module EVM where
55

6-
import Prelude hiding (exponent)
6+
import Prelude hiding (exponent, Foldable(..))
77

88
import Optics.Core
99
import Optics.State
@@ -40,7 +40,7 @@ import Data.ByteString.Char8 qualified as Char8
4040
import Data.DoubleWord (Int256, Word256)
4141
import Data.Either (partitionEithers)
4242
import Data.Either.Extra (maybeToEither)
43-
import Data.Foldable (toList)
43+
import Data.Foldable (toList, Foldable(..))
4444
import Data.List (find, isPrefixOf)
4545
import Data.List.Split (splitOn)
4646
import Data.Map.Strict (Map)
@@ -2811,7 +2811,7 @@ mkOpIxMap (RuntimeCode (ConcreteRuntimeCode ops)) =
28112811

28122812
mkOpIxMap (RuntimeCode (SymbolicRuntimeCode ops))
28132813
= VS.create $ VS.Mutable.new (length ops) >>= \v ->
2814-
let (_, _, _, m) = foldl (go v) (0, 0, 0, pure ()) (stripBytecodeMetadataSym $ V.toList ops)
2814+
let (_, _, _, m) = foldl' (go v) (0, 0, 0, pure ()) (stripBytecodeMetadataSym $ V.toList ops)
28152815
in m >> pure v
28162816
where
28172817
go v (0, !i, !j, !m) x = case maybeLitByteSimp x of

src/EVM/ABI.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ module EVM.ABI
5959
, showAlter
6060
) where
6161

62+
import Prelude hiding (Foldable(..))
63+
6264
import EVM.Expr (readWord, isLitWord)
6365
import EVM.Types
6466
import EVM.Expr (maybeLitWordSimp)
@@ -76,13 +78,14 @@ import Data.ByteString.Lazy qualified as BSLazy
7678
import Data.Char (isHexDigit)
7779
import Data.Data (Data)
7880
import Data.DoubleWord (Word256, Int256, signedWord)
81+
import Data.Foldable (Foldable(..))
7982
import Data.Functor (($>))
8083
import Data.List (intercalate)
8184
import Data.Maybe (mapMaybe)
8285
import Data.Text (Text)
8386
import Data.Text qualified as Text
8487
import Data.Text.Encoding (encodeUtf8)
85-
import Data.Vector (Vector, toList)
88+
import Data.Vector (Vector)
8689
import Data.Vector qualified as Vector
8790
import Data.Word (Word32)
8891
import GHC.Generics (Generic)
@@ -391,7 +394,7 @@ typeWithArraySuffix v = do
391394
parseSize t "" = AbiArrayDynamicType t
392395
parseSize t s = AbiArrayType (read s) t
393396

394-
pure (foldl parseSize base sizes)
397+
pure (foldl' parseSize base sizes)
395398

396399
basicType :: Vector AbiType -> P.Parsec () Text AbiType
397400
basicType v =

src/EVM/Facts.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ module EVM.Facts
2929
, fileToFact
3030
) where
3131

32+
import Prelude hiding (Foldable(..))
33+
3234
import EVM (bytecode, initialContract, loadContract)
3335
import EVM.Expr (writeStorage)
3436
import EVM.Types
@@ -42,6 +44,7 @@ import Data.ByteString (ByteString)
4244
import Data.ByteString.Base16 qualified as BS16
4345
import Data.ByteString qualified as BS
4446
import Data.ByteString.Char8 qualified as Char8
47+
import Data.Foldable (Foldable(..))
4548
import Data.Map (Map)
4649
import Data.Map qualified as Map
4750
import Data.Set (Set)
@@ -210,13 +213,13 @@ instance Ord Fact where
210213
apply :: VM s -> Set Fact -> VM s
211214
apply =
212215
-- The set's ordering is relevant; see `apply1`.
213-
foldl apply1
216+
foldl' apply1
214217
--
215218
-- Applies a set of facts to a VM.
216219
applyCache :: VM s -> Set Fact -> VM s
217220
applyCache =
218221
-- The set's ordering is relevant; see `apply1`.
219-
foldl apply2
222+
foldl' apply2
220223

221224
factToFile :: Fact -> File
222225
factToFile fact = case fact of

src/EVM/Fetch.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ module EVM.Fetch
1919
, addFetchCache
2020
) where
2121

22+
import Prelude hiding (Foldable(..))
23+
2224
import EVM (initialContract, unknownContract)
2325
import EVM.ABI
2426
import EVM.FeeSchedule (feeSchedule)
@@ -38,9 +40,9 @@ import Data.ByteString qualified as BS
3840
import Data.Text (Text, unpack, pack)
3941
import Data.Text qualified as T
4042
import Data.Text.Encoding qualified as T
43+
import Data.Foldable (Foldable(..))
4144
import Data.Map.Strict qualified as Map
4245
import Data.Maybe (fromMaybe, isJust, fromJust)
43-
import Data.List (foldl')
4446
import Data.Vector qualified as RegularVector
4547
import Network.Wreq
4648
import Network.Wreq.Session qualified as NetSession

src/EVM/SMT.hs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ module EVM.SMT
2828
getStore
2929
) where
3030

31-
import Prelude hiding (LT, GT)
31+
import Prelude hiding (LT, GT, Foldable(..))
3232

3333
import Control.Monad
3434
import Data.Containers.ListUtils (nubOrd, nubInt)
3535
import Data.ByteString (ByteString)
3636
import Data.ByteString qualified as BS
37+
import Data.Foldable (Foldable(..))
3738
import Data.List qualified as List
3839
import Data.List.NonEmpty (NonEmpty((:|)))
3940
import Data.List.NonEmpty qualified as NonEmpty
@@ -136,13 +137,13 @@ assertPropsHelper simp psPreConc = do
136137
intermediates <- declareIntermediates bufs stores
137138
readAssumes' <- readAssumes
138139
keccakAssertions' <- keccakAssertions
139-
frameCtxs <- (declareFrameContext . nubOrd $ foldl (<>) [] frameCtx)
140-
blockCtxs <- (declareBlockContext . nubOrd $ foldl (<>) [] blockCtx)
140+
frameCtxs <- (declareFrameContext . nubOrd $ foldl' (<>) [] frameCtx)
141+
blockCtxs <- (declareBlockContext . nubOrd $ foldl' (<>) [] blockCtx)
141142
pure $ prelude
142143
<> SMT2 (SMTScript (declareAbstractStores abstractStores)) mempty mempty
143144
<> declareConstrainAddrs addresses
144145
<> (declareBufs toDeclarePsElim bufs stores)
145-
<> (declareVars . nubOrd $ foldl (<>) [] allVars)
146+
<> (declareVars . nubOrd $ foldl' (<>) [] allVars)
146147
<> frameCtxs
147148
<> blockCtxs
148149
<> SMT2 (SMTScript intermediates) mempty mempty
@@ -271,7 +272,7 @@ findStorageReads p = foldProp go mempty p
271272
baseIsAbstractStore (GVar _) = internalError "Unexpected GVar"
272273

273274
findBufferAccess :: TraversableTerm a => [a] -> [(Expr EWord, Expr EWord, Expr Buf)]
274-
findBufferAccess = foldl (foldTerm go) mempty
275+
findBufferAccess = foldl' (foldTerm go) mempty
275276
where
276277
go :: Expr a -> [(Expr EWord, Expr EWord, Expr Buf)]
277278
go = \case
@@ -309,7 +310,7 @@ discoverMaxReads props benv senv = bufMap
309310
-- we assign a default read hint of 4 to start with in these cases (since in most cases we will need at least 4 bytes to produce a counterexample)
310311
allBufs = Map.fromList . fmap (, Lit 4) . fmap toLazyText . nubOrd . concat $ fmap referencedBufs props <> fmap referencedBufs (Map.elems benv) <> fmap referencedBufs (Map.elems senv)
311312

312-
bufMap = Map.unionWith Expr.max (foldl addBound mempty allReads) allBufs
313+
bufMap = Map.unionWith Expr.max (foldl' addBound mempty allReads) allBufs
313314

314315
addBound m (idx, size, buf) =
315316
case baseBuf buf of

src/EVM/SymExec.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
module EVM.SymExec where
55

6+
import Prelude hiding (Foldable(..))
7+
68
import Control.Arrow ((>>>))
79
import Control.Concurrent.Async (concurrently, mapConcurrently)
810
import Control.Concurrent.Spawn (parMapIO, pool)
@@ -15,7 +17,8 @@ import Data.ByteString (ByteString)
1517
import Data.ByteString qualified as BS
1618
import Data.Containers.ListUtils (nubOrd)
1719
import Data.DoubleWord (Word256)
18-
import Data.List (foldl', sortBy, sort)
20+
import Data.Foldable (Foldable(..))
21+
import Data.List (sortBy, sort)
1922
import Data.List.NonEmpty qualified as NE
2023
import Data.Maybe (fromMaybe, listToMaybe, mapMaybe)
2124
import Data.Map.Strict (Map)
@@ -705,7 +708,7 @@ verify solvers fetcher opts preState maybepost = do
705708
pure $ verifyResults preState expr res
706709

707710
verifyResults :: VM Symbolic RealWorld -> Expr End -> [(SMTResult, Expr End)] -> (Expr End, [VerifyResult])
708-
verifyResults preState expr cexs = if Prelude.null cexs then (expr, [Qed]) else (expr, fmap toVRes cexs)
711+
verifyResults preState expr cexs = if null cexs then (expr, [Qed]) else (expr, fmap toVRes cexs)
709712
where
710713
toVRes :: (SMTResult, Expr End) -> VerifyResult
711714
toVRes (res, leaf) = case res of

src/EVM/Traversals.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
-}
55
module EVM.Traversals where
66

7-
import Prelude hiding (LT, GT)
7+
import Prelude hiding (LT, GT, Foldable(..))
88

99
import Control.Monad (forM, void)
1010
import Control.Monad.Identity (Identity(Identity), runIdentity)
11+
import Data.Foldable (Foldable(..))
1112
import Data.Map.Strict qualified as Map
12-
import Data.List (foldl')
1313

1414
import EVM.Types
1515

@@ -89,13 +89,13 @@ foldExpr f acc expr = acc <> (go expr)
8989
-- control flow
9090

9191
e@(Success a _ c d) -> f e
92-
<> foldl (foldProp f) mempty a
92+
<> foldl' (foldProp f) mempty a
9393
<> go c
9494
<> foldl' (foldExpr f) mempty (Map.keys d)
9595
<> foldl' (foldEContract f) mempty d
96-
e@(Failure a _ (Revert c)) -> f e <> (foldl (foldProp f) mempty a) <> go c
97-
e@(Failure a _ _) -> f e <> (foldl (foldProp f) mempty a)
98-
e@(Partial a _ _) -> f e <> (foldl (foldProp f) mempty a)
96+
e@(Failure a _ (Revert c)) -> f e <> (foldl' (foldProp f) mempty a) <> go c
97+
e@(Failure a _ _) -> f e <> (foldl' (foldProp f) mempty a)
98+
e@(Partial a _ _) -> f e <> (foldl' (foldProp f) mempty a)
9999
e@(ITE a b c) -> f e <> (go a) <> (go b) <> (go c)
100100

101101
-- integers
@@ -168,7 +168,7 @@ foldExpr f acc expr = acc <> (go expr)
168168

169169
-- logs
170170

171-
e@(LogEntry a b c) -> f e <> (go a) <> (go b) <> (foldl (<>) mempty (fmap f c))
171+
e@(LogEntry a b c) -> f e <> (go a) <> (go b) <> (foldl' (<>) mempty (fmap f c))
172172

173173
-- storage
174174

src/EVM/Types.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
module EVM.Types where
1313

14+
import Prelude hiding (Foldable(..))
15+
1416
import GHC.Stack (HasCallStack, prettyCallStack, callStack)
1517
import GHC.ByteOrder (targetByteOrder, ByteOrder(..))
1618
import Control.Arrow ((>>>))
@@ -25,7 +27,6 @@ import Data.Bits (Bits, FiniteBits, shiftR, shift, shiftL, (.&.), (.|.), toInteg
2527
import Data.Binary qualified as Binary
2628
import Data.ByteArray qualified as BA
2729
import Data.Char
28-
import Data.List (foldl')
2930
import Data.ByteString (ByteString)
3031
import Data.ByteString qualified as BS
3132
import Data.ByteString.Base16 qualified as BS16
@@ -38,6 +39,7 @@ import Data.Int (Int64)
3839
import Data.Word (Word8, Word32, Word64, byteSwap32, byteSwap64)
3940
import Data.DoubleWord
4041
import Data.DoubleWord.TH
42+
import Data.Foldable (Foldable(..))
4143
import Data.Map (Map)
4244
import Data.Maybe (fromMaybe)
4345
import Data.Set (Set)
@@ -1503,7 +1505,7 @@ constructWord256 bytes
15031505
w256m0 = word8sToWord64 (take 8 (drop 16 bytes))
15041506
w256lo = word8sToWord64 (take 8 (drop 24 bytes))
15051507
word8sToWord64 :: [Word8] -> Word64
1506-
word8sToWord64 = foldl (\acc byte -> (acc `shiftL` 8) .|. fromIntegral byte) 0
1508+
word8sToWord64 = foldl' (\acc byte -> (acc `shiftL` 8) .|. fromIntegral byte) 0
15071509

15081510

15091511
-- Keccak hashing ----------------------------------------------------------------------------------

src/EVM/UnitTest.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
module EVM.UnitTest where
44

5+
import Prelude hiding (Foldable(..))
6+
57
import EVM
68
import EVM.ABI
79
import EVM.Solvers
@@ -20,7 +22,6 @@ import EVM.Stepper (Stepper)
2022
import EVM.Stepper qualified as Stepper
2123
import EVM.Tracing qualified as Tracing
2224
import EVM.Expr (maybeLitWordSimp)
23-
import Data.List (foldl')
2425

2526
import Control.Monad (void, when, forM, forM_)
2627
import Control.Monad.ST (RealWorld, ST, stToIO)
@@ -34,7 +35,7 @@ import Data.ByteString.Char8 qualified as BS
3435
import Data.ByteString.Internal (c2w)
3536
import Data.ByteString.Lazy qualified as BSLazy
3637
import Data.Decimal (DecimalRaw(..))
37-
import Data.Foldable (toList)
38+
import Data.Foldable (Foldable(..), toList)
3839
import Data.Map (Map)
3940
import Data.Map qualified as Map
4041
import Data.Maybe

0 commit comments

Comments
 (0)