git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: simplify "commonPrefix" implementation
50aa7bfAlexander Krotov
src/Text/Pandoc/Readers/Muse.hs+1−5
@@ -139,11 +139,7 @@ parseMuse = do
139-- * Utility functions
139-- * Utility functions
140
140
141commonPrefix :: String -> String -> String
141commonPrefix :: String -> String -> String
142−commonPrefix _ [] = []
142+commonPrefix xs ys = map fst $ takeWhile (uncurry (==)) $ zip xs ys
143−commonPrefix [] _ = []
144−commonPrefix (x:xs) (y:ys)
145− | x == y = x : commonPrefix xs ys
146− | otherwise = []
147
143
148-- | Trim up to one newline from the beginning of the string.
144-- | Trim up to one newline from the beginning of the string.
149lchop :: String -> String
145lchop :: String -> String