From 3445de9bfa4e87c2c0d45dbb33c69da1835ee959 Mon Sep 17 00:00:00 2001 From: Simon Hengel Date: Tue, 22 Oct 2024 10:51:56 +0700 Subject: [PATCH] Reduce runtime complexity `normalizeTypeSignatures` --- src/Util.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Util.hs b/src/Util.hs index 979636bd..7cf7e306 100644 --- a/src/Util.hs +++ b/src/Util.hs @@ -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' -> "->"