Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix new hlint issues after update (hlint-3.6.1) #1132

Merged
merged 2 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Echidna/Campaign.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ instance MonadThrow m => MonadThrow (RandT g m) where
-- | Given a 'Campaign', check if the test results should be reported as a
-- success or a failure.
isSuccessful :: [EchidnaTest] -> Bool
isSuccessful tests =
all (\case { Passed -> True; Open -> True; _ -> False; }) ((.state) <$> tests)
isSuccessful =
all (\case { Passed -> True; Open -> True; _ -> False; } . (.state))

-- | Run all the transaction sequences from the corpus and accumulate campaign
-- state. Can be used to minimize corpus as the final campaign state will
Expand Down
2 changes: 1 addition & 1 deletion lib/Echidna/Events.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extractEvents :: Bool -> DappInfo -> VM -> Events
extractEvents decodeErrors dappInfo vm =
let forest = traceForest vm
in maybeToList (decodeRevert decodeErrors vm)
++ catMaybes (concatMap flatten (fmap (fmap showTrace) forest))
++ concatMap ((catMaybes . flatten) . fmap showTrace) forest
where
showTrace trace =
let ?context = DappContext { info = dappInfo, env = vm.env.contracts } in
Expand Down
13 changes: 7 additions & 6 deletions lib/Echidna/Solidity.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Data.List.NonEmpty (NonEmpty((:|)))
import Data.List.NonEmpty qualified as NE
import Data.List.NonEmpty.Extra qualified as NEE
import Data.Map qualified as Map
import Data.Maybe (isJust, isNothing, catMaybes, listToMaybe)
import Data.Maybe (isJust, isNothing, catMaybes, listToMaybe, mapMaybe)
import Data.Set (Set)
import Data.Set qualified as Set
import Data.Text (Text, isPrefixOf, isSuffixOf, append)
Expand Down Expand Up @@ -211,11 +211,12 @@ loadSpecified env name cs = do
-- Construct ABI mapping for World
abiMapping =
if solConf.allContracts then
Map.fromList $ catMaybes $ cs <&> \contract ->
let filtered = filterMethods contract.contractName
solConf.methodFilter
(abiOf solConf.prefix contract)
in (getBytecodeMetadata contract.runtimeCode,) <$> NE.nonEmpty filtered
Map.fromList $ mapMaybe (\contract ->
let filtered = filterMethods contract.contractName
solConf.methodFilter
(abiOf solConf.prefix contract)
in (getBytecodeMetadata contract.runtimeCode,) <$> NE.nonEmpty filtered)
cs
else
case NE.nonEmpty fabiOfc of
Just ne -> Map.singleton (getBytecodeMetadata mainContract.runtimeCode) ne
Expand Down