Copyright | 2013-2018 Luis Pedro Coelho |
---|---|
License | MIT |
Maintainer | luis@luispedro.org |
Safe Haskell | None |
Language | Haskell2010 |
Simple algorithms packaged as Conduits
Synopsis
- uniqueOnC :: (Ord b, Monad m) => (a -> b) -> ConduitT a a m ()
- uniqueC :: (Ord a, Monad m) => ConduitT a a m ()
- removeRepeatsC :: (Eq a, Monad m) => ConduitT a a m ()
- mergeC :: (Ord a, Monad m) => [ConduitT () a m ()] -> ConduitT () a m ()
- mergeC2 :: (Ord a, Monad m) => ConduitT () a m () -> ConduitT () a m () -> ConduitT () a m ()
Documentation
uniqueOnC :: (Ord b, Monad m) => (a -> b) -> ConduitT a a m () Source #
Unique conduit.
For each element, it checks its key (using the a -> b
key function) and
yields it if it has not seen it before.
Note that this conduit does not assume that the input is sorted. Instead
it uses a Set
to store previously seen elements. Thus, memory usage
is O(N) and time is O(N log N). If the input is sorted, you can use
removeRepeatsC
uniqueC :: (Ord a, Monad m) => ConduitT a a m () Source #
Unique conduit
See uniqueOnC
and removeRepeatsC