Skip to content

Commit

Permalink
Reduce runtime complexity normalizeTypeSignatures
Browse files Browse the repository at this point in the history
  • Loading branch information
sol committed Oct 22, 2024
1 parent 461b4db commit 3445de9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ gitCheckIgnoreFeedback err
normalizeTypeSignatures :: String -> String
normalizeTypeSignatures = normalize . concatMap replace
where
normalize :: [Char] -> [Char]
normalize = \case
'\n' : ' ' : ' ' : xs -> normalizeTypeSignatures (' ' : dropWhile (== ' ') xs)
x : xs -> x : normalizeTypeSignatures xs
'\n' : ' ' : ' ' : xs -> normalize (' ' : dropWhile (== ' ') xs)
x : xs -> x : normalize xs
[] -> []

replace :: Char -> [Char]
replace c = case c of
'\8759' -> "::"
'\8594' -> "->"
Expand Down

0 comments on commit 3445de9

Please sign in to comment.