From 50aa7bfddc8c1b4b92c227174a9014ec84c02091 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Tue, 16 Oct 2018 16:23:59 +0300 Subject: Muse reader: simplify "commonPrefix" implementation --- src/Text/Pandoc/Readers/Muse.hs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs index 4cc6b4dff..1507ff2c9 100644 --- a/src/Text/Pandoc/Readers/Muse.hs +++ b/src/Text/Pandoc/Readers/Muse.hs @@ -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 -- cgit v1.2.3