@@ -37,13 +37,12 @@ compressSeparators [] = []
3737compressSeparators str
3838 | isPrefixOf "\"" str = head str : retainConstants compressSeparators "\"" (drop 1 str)
3939 | isPrefixOf "'" str = head str : retainConstants compressSeparators "'" (drop 1 str)
40− | stripFirst = compressSeparators (drop 1 str)
40+ | stripFirst = compressSeparators (drop 1 str)
4141 | stripSecond = compressSeparators (head str : (drop 2 str))
42− | otherwise = head str : compressSeparators (drop 1 str)
42+ | otherwise = head str : compressSeparators (drop 1 str)
4343 where
44− prefix p = isPrefixOf p str
45− stripFirst = or $ map prefix [" ", " {", " }", ";;", ";}"]
46− stripSecond = or $ map prefix ["{ ", "} ", "; "]
44+ stripFirst = or $ map (isOfPrefix str) [" ", " {", " }", ";;", ";}"]
45+ stripSecond = or $ map (isOfPrefix str) ["{ ", "} ", "; "]
4746
4847--------------------------------------------------------------------------------
4948-- | Compresses all whitespace.
@@ -56,9 +55,8 @@ compressWhitespace str
5655 | replaceTwo = compressWhitespace (' ' : (drop 2 str))
5756 | otherwise = head str : compressWhitespace (drop 1 str)
5857 where
59− prefix p = isPrefixOf p str
60− replaceOne = or $ map prefix ["\t", "\n", "\r"]
61− replaceTwo = or $ map prefix [" \t", " \n", " \r", " "]
58+ replaceOne = or $ map (isOfPrefix str) ["\t", "\n", "\r"]
59+ replaceTwo = or $ map (isOfPrefix str) [" \t", " \n", " \r", " "]
6260
6361--------------------------------------------------------------------------------
6462-- | Function that strips CSS comments away.
@@ -82,3 +80,8 @@ retainConstants f delim str
8280 | null str = []
8381 | isPrefixOf delim str = head str : f (drop 1 str)
8482 | otherwise = head str : retainConstants f delim (drop 1 str)
83+
84+--------------------------------------------------------------------------------
85+-- | Helper function to determine whether a string is a substring.
86+isOfPrefix :: String -> String -> Bool
87+isOfPrefix = flip isPrefixOf