Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
deduplicating : (Eq a, Monad m) => Pipe a m a
deduplicating = recur (the (a -> Bool) (const True)) where
recur isDifferent =
awaitOne $ \x => do
when (isDifferent x) (yield x)
recur (/= x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment