<div dir="ltr">I was mainly asking if it makes sense to include these functions in base/Data.List. Since the base package is maintained and ships along with ghc, and the issues are also raised at ghc trac I thought this is the right list. I am copying to <a href="mailto:libraries@haskell.org">libraries@haskell.org</a> as well. <div><br></div><div>-harendra</div><div class="gmail_extra"><br><div class="gmail_quote">On 5 February 2018 at 09:53, David Feuer <span dir="ltr"><<a href="mailto:david@well-typed.com" target="_blank">david@well-typed.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>This is the wrong list. You probably meant to email haskell-cafe or perhaps <a href="mailto:libraries@haskell.org" target="_blank">libraries@haskell.org</a>.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div><br></div><div><br></div><div id="m_-3724189584733760938composer_signature"><div style="font-size:85%;color:#575757">David Feuer</div><div style="font-size:85%;color:#575757">Well-Typed, LLP</div></div></font></span><div><div class="h5"><div><br></div><div style="font-size:100%;color:#000000"><div>-------- Original message --------</div><div>From: Harendra Kumar <<a href="mailto:harendra.kumar@gmail.com" target="_blank">harendra.kumar@gmail.com</a>> </div><div>Date: 2/4/18  10:50 PM  (GMT-05:00) </div><div>To: <a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a> </div><div>Subject: rolling span and groupBy for lists </div><div><br></div></div>Hi,<br><br>For a small problem, I was looking for a groupBy like function that groups<br>based on a predicate on successive elements but I could not find one. I<br>wrote these little functions for that purpose:<br><br>-- | Like span, but with a predicate that compares two successive elements.<br>The<br>-- span ends when the two successive elements do not satisfy the predicate.<br>rollingSpan :: (a -> a -> Bool) -> [a] -> ([a], [a])<br>rollingSpan _ xs@[] = (xs, xs)<br>rollingSpan _ xs@[_] = (xs, [])<br>rollingSpan p (x1:xs@(x2:_))<br>    | p x1 x2 =<br>        let (ys, zs) = rollingSpan p xs<br>        in (x1 : ys, zs)<br>    | otherwise = ([x1], xs)<br><br>-- | Like 'groupBy' but with a predicate that compares two successive<br>elements.<br>-- A group ends when two successive elements do not satisfy the predicate.<br>rollingGroupBy :: (a -> a -> Bool) -> [a] -> [[a]]<br>rollingGroupBy _ [] = []<br>rollingGroupBy cmp xs =<br>    let (ys, zs) = rollingSpan cmp xs<br>    in ys : rollingGroupBy cmp zs<br><br>Are there any existing functions that serve this purpose or is there any<br>simpler way to achieve such functionality? If not, where is the right place<br>for these, if any. Can they be included in Data.List in base?<br><br>Thanks,<br>Harendra<br></div></div></div></blockquote></div><br></div></div>