git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: simplify "commonPrefix" implementation
commit50aa7bfddc8c1b4b92c227174a9014ec84c02091 authorAlexander Krotov <ilabdsf@gmail.com> dateTue 16 Oct 2018, 16:23 (8 years ago) parentd3ba2fc
1 file changed+1−5
src/Text/Pandoc/Readers/Muse.hs+1−5
src/Text/Pandoc/Readers/Muse.hs+1−5
@@ -139,11 +139,7 @@ parseMuse = do
139139-- * Utility functions
140140
141141commonPrefix :: String -> String -> String
142−commonPrefix _ [] = []
143−commonPrefix [] _ = []
144−commonPrefix (x:xs) (y:ys)
145− | x == y = x : commonPrefix xs ys
146− | otherwise = []
142+commonPrefix xs ys = map fst $ takeWhile (uncurry (==)) $ zip xs ys
147143
148144-- | Trim up to one newline from the beginning of the string.
149145lchop :: String -> String