git.iko.soy/typeable/pandoc
on master help sign in
Change head/tail to pattern guards.
c15978cJesse Rosenthal
src/Text/Pandoc/Readers/Docx/Reducible.hs+8−7
@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings #-}
1+{-# LANGUAGE OverloadedStrings, PatternGuards #-}
2
2
3{-
3{-
4Copyright (C) 2014 Jesse Rosenthal <jrosenthal@jhu.edu>
4Copyright (C) 2014 Jesse Rosenthal <jrosenthal@jhu.edu>
@@ -87,12 +87,13 @@ combineReducibles r s =
87 remaining' = conts' \\ shared
87 remaining' = conts' \\ shared
88 in
88 in
89 case null shared of
89 case null shared of
90− True -> case () of
90+ True | (x : xs) <- reverse rs
91− _ | (not . null) rs && isSpace (last rs) ->
91+ , isSpace x ->
92− rebuild conts (init rs) ++ [last rs, s]
92+ rebuild conts (reverse xs) ++ [x, s]
93+ | (x : xs) <- ss
93− _ | (not . null) ss && isSpace (head ss) ->
94+ , isSpace x ->
94− [r, head ss] ++ rebuild conts' (tail ss)
95+ [r, x] ++ rebuild conts' (xs)
95− _ -> [r,s]
96+ True -> [r,s]
96 False -> rebuild
97 False -> rebuild
97 shared $
98 shared $
98 reduceList $
99 reduceList $