Skip to content

Commit

Permalink
Add brackets on refactoring templates when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
zliu41 committed Mar 27, 2022
1 parent 6ce5a70 commit be0adda
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions data/hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,8 @@
# foo = last (sortBy (compare `on` fst) xs) -- maximumBy (compare `on` fst) xs
# g = \ f -> parseFile f >>= (\ cu -> return (f, cu))
# foo = bar $ \(x,y) -> x x y
# f = const [] . (>>= const Nothing) . const Nothing -- (const Nothing Control.Monad.<=< const Nothing)
# f = g . either Left h x -- (h =<< x)
# foo = (\x -> f x >>= g) -- f Control.Monad.>=> g
# foo = (\f -> h f >>= g) -- h Control.Monad.>=> g
# foo = (\f -> h f >>= f)
Expand Down
2 changes: 1 addition & 1 deletion src/Hint/Match.hs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ matchIdea sb declName HintRule{..} parent x = do
guard $ checkDefine declName parent rhs

(u, tpl) <- pure $ if any ((== noSrcSpan) . locA . getLoc . snd) (fromSubst u) then (mempty, res) else (u, tpl)
tpl <- pure $ unqualify sa sb (performSpecial tpl)
tpl <- pure $ unqualify sa sb (addBracket parent $ performSpecial tpl)

pure ( res, tpl, hintRuleNotes,
[ (s, toSSA pos') | (s, pos) <- fromSubst u, locA (getLoc pos) /= noSrcSpan
Expand Down

0 comments on commit be0adda

Please sign in to comment.