Open philderbeast opened 2 years ago
For the foldl anti-pattern stan finds a few hints like the following:
The same thing from the command line:
File: src/Language/Fixpoint/Parse.hs
Module: Language.Fixpoint.Parse
LoC: 1652
Observations: 1
Extensions from .cabal:
Extensions from module: FlexibleContexts, FlexibleInstances, NoMonomorphismRestriction, UndecidableInstances, DeriveGeneric, OverloadedStrings
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
┃ ✦ ID: OBS-STAN-0202-6VNRVE-1385:18
┃ ✦ Severity: Error
┃ ✦ Inspection ID: STAN-0202
┃ ✦ Name: Anti-pattern: foldl
┃ ✦ Description: Usage of space-leaking function 'foldl'
┃ ✦ Category: #SpaceLeak #AntiPattern
┃ ✦ File: src/Language/Fixpoint/Parse.hs
┃
┃ 1384 ┃
┃ 1385 ┃ rwMap = foldl insert (M.fromList []) rwEntries
┃ 1386 ┃ ^^^^^
┃
┃ 💡 Possible solution:
┃ ⍟ Replace 'foldl' with 'foldl''
┃ ⍟ Use 'foldr (flip . f)` instead of 'foldl f'
I've tried running stan over liquid-fixpoint. Some of its suggestions I expect we'd want to pursue. Like with the recent hlint changes there are some hints we'd ignore and there is a config file where we can turn those off.