@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings #-}
1+{-# LANGUAGE OverloadedStrings, PatternGuards #-}
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
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− _ | (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
98 reduceList $
99 reduceList $