Copyright | 2013-2021 Luis Pedro Coelho |
---|---|
License | MIT |
Maintainer | [email protected] |
Safe Haskell | None |
Language | Haskell2010 |
Data.Conduit.Algorithms
Description
Simple algorithms packaged as Conduits
Synopsis
- uniqueOnC :: forall b (m :: Type -> Type) a. (Ord b, Monad m) => (a -> b) -> ConduitT a a m ()
- uniqueC :: forall a (m :: Type -> Type). (Ord a, Monad m) => ConduitT a a m ()
- removeRepeatsC :: forall a (m :: Type -> Type). (Eq a, Monad m) => ConduitT a a m ()
- mergeC :: forall a (m :: Type -> Type). (Ord a, Monad m) => [ConduitT () a m ()] -> ConduitT () a m ()
- mergeC2 :: forall a (m :: Type -> Type). (Ord a, Monad m) => ConduitT () a m () -> ConduitT () a m () -> ConduitT () a m ()
Documentation
uniqueOnC :: forall b (m :: Type -> Type) a. (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 :: forall a (m :: Type -> Type). (Ord a, Monad m) => ConduitT a a m () Source #
Unique conduit
See uniqueOnC
and removeRepeatsC