Muse reader: simplify "commonPrefix" implementation
This commit is contained in:
parent
d3ba2fc3d8
commit
50aa7bfddc
1 changed files with 1 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue