Muse reader: simplify "commonPrefix" implementation

This commit is contained in:
Alexander Krotov 2018-10-16 16:23:59 +03:00
parent d3ba2fc3d8
commit 50aa7bfddc

View file

@ -139,11 +139,7 @@ parseMuse = do
-- * Utility functions
commonPrefix :: String -> String -> String
commonPrefix _ [] = []
commonPrefix [] _ = []
commonPrefix (x:xs) (y:ys)
| x == y = x : commonPrefix xs ys
| otherwise = []
commonPrefix xs ys = map fst $ takeWhile (uncurry (==)) $ zip xs ys
-- | Trim up to one newline from the beginning of the string.
lchop :: String -> String