Skip to content

Commit

Permalink
[#368] Update 'unordered-containers' inspections (#369)
Browse files Browse the repository at this point in the history
* [#368] Update 'unordered-containers' inspections

Resolves #368

* Fix stack build
  • Loading branch information
chshersh authored Aug 7, 2020
1 parent 45a19d6 commit efc7fe5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ The change log is available [on GitHub][2].

* [#55](https://github.com/kowainik/stan/issues/55):
Implement single-pass HIE AST traversal.
* [#348](https://github.com/kowainik/stan/issues/348):
Compress binaries for GitHub releases.
* [#368](https://github.com/kowainik/stan/issues/368):
Fix inspections for `unordered-containers` functions to support the
latest package version.

## 0.0.1.0 — Jul 9, 2020

Expand Down
10 changes: 5 additions & 5 deletions src/Stan/Inspection/AntiPattern.hs
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,15 @@ stan0204 = mkAntiPatternInspection (Id "STAN-0204") "HashMap size"
:| [(mkBaseFoldableMeta "length", hmPat)]

sizeNameMeta :: NameMeta
sizeNameMeta = "size" `unorderedNameFrom` "Data.HashMap.Base"
sizeNameMeta = "size" `unorderedNameFrom` "Data.HashMap.Internal"

hm :: NameMeta
hm = "HashMap" `unorderedNameFrom` "Data.HashMap.Base"
hm = "HashMap" `unorderedNameFrom` "Data.HashMap.Internal"

hmPat :: PatternType
hmPat = (hm |:: [(?), (?)]) |-> (?)

-- | 'Inspection' — slow 'Data.HashMap.Strict.size' @STAN-0205@.
-- | 'Inspection' — slow 'Data.HashSet.size' @STAN-0205@.
stan0205 :: Inspection
stan0205 = mkAntiPatternInspection (Id "STAN-0205") "HashSet size"
(FindAst $ namesToPatternAst pats)
Expand All @@ -185,10 +185,10 @@ stan0205 = mkAntiPatternInspection (Id "STAN-0205") "HashSet size"
:| [(mkBaseFoldableMeta "length", hsPat)]

sizeNameMeta :: NameMeta
sizeNameMeta = "size" `unorderedNameFrom` "Data.HashSet.Base"
sizeNameMeta = "size" `unorderedNameFrom` "Data.HashSet.Internal"

hs :: NameMeta
hs = "HashSet" `unorderedNameFrom` "Data.HashSet.Base"
hs = "HashSet" `unorderedNameFrom` "Data.HashSet.Internal"

hsPat :: PatternType
hsPat = (hs |:: [(?)]) |-> (?)
Expand Down
1 change: 1 addition & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ extra-deps:
- trial-0.0.0.0
- trial-optparse-applicative-0.0.0.0
- trial-tomland-0.0.0.0
- unordered-containers-0.2.12.0

0 comments on commit efc7fe5

Please sign in to comment.