From 0ea6286197c6797260728653b7739746a277efa3 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 13 Apr 2016 16:05:48 -0400 Subject: [PATCH] Split the body of spanAndSplitFirstLines onto a newline and dedent. --- src/Alignment.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Alignment.hs b/src/Alignment.hs index 51e1f8289..db7f22c08 100644 --- a/src/Alignment.hs +++ b/src/Alignment.hs @@ -155,12 +155,13 @@ group2 ranges children | Just (headRanges, tailRanges) <- unconsThese ranges spanAndSplitFirstLines :: (Join These a -> Join These Bool) -> [[Join These a]] -> ([(Join These a, [Join These a])], [[Join These a]]) spanAndSplitFirstLines pred = foldr go ([], []) - where go (first : rest) (intersecting, nonintersecting) = - let ~(l, r) = split first in case fromThese False False . runJoin $ pred first of - (True, True) -> ((first, rest) : intersecting, nonintersecting) - (True, False) -> ((head l, r ++ rest) : intersecting, nonintersecting) - (False, True) -> ((head r, l ++ rest) : intersecting, nonintersecting) - _ -> (intersecting, (first : rest) : nonintersecting) + where go child (intersecting, nonintersecting) + | (first : rest) <- child = let ~(l, r) = split first in + case fromThese False False . runJoin $ pred first of + (True, True) -> ((first, rest) : intersecting, nonintersecting) + (True, False) -> ((head l, r ++ rest) : intersecting, nonintersecting) + (False, True) -> ((head r, l ++ rest) : intersecting, nonintersecting) + _ -> (intersecting, (first : rest) : nonintersecting) -- | Partitions and splits a list of children into a tuple consisting of: -- | - elements which matched; if an element matches only partially this field will contain only the matching side