>>>>> John Wiegley <jo...@newartisans.com> writes:

> Is this what you are looking for:

>   foldValues :: (Monad m, Eq k) => (v -> v -> v) -> Pipe (k, v) (k, v) m r
>   foldValues append = loop Nothing
>     where
>       loop mx = do
>           (k, v) <- await
>           yield (k, maybe v (`append` v) mx)
>           loop (Just v)

Ah, n/m, you wanted aggregation of values within key groups.  You could add
the key as part of the "state" in mx, to determine whether to append or
restart tracking of v.

John

-- 
You received this message because you are subscribed to the Google Groups 
"Haskell Pipes" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to haskell-pipes+unsubscr...@googlegroups.com.
To post to this group, send email to haskell-pipes@googlegroups.com.

Reply via email to