Hoogle Search

Within LTS Haskell 24.45 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. rmapM :: Monad m => (b -> m c) -> Fold m a b -> Fold m a c

    streamly-core Streamly.Internal.Data.Fold

    Map a monadic function on the output of a fold.

  2. rollingMapM :: Monad m => (Maybe a -> a -> m b) -> Fold m a b

    streamly-core Streamly.Internal.Data.Fold

    Apply a function on every two successive elements of a stream. The first argument of the map function is the previous element and the second argument is the current element. When processing the very first element in the stream, the previous element is Nothing. Pre-release

  3. toMap :: forall (m :: Type -> Type) k a b . (Monad m, Ord k) => (a -> k) -> Fold m a b -> Fold m a (Map k b)

    streamly-core Streamly.Internal.Data.Fold

    Split the input stream based on a key field and fold each split using the given fold. Useful for map/reduce, bucketizing the input in different bins or for generating histograms. Example:

    >>> import Data.Map.Strict (Map)
    
    >>> :{
    let input = Stream.fromList [("ONE",1),("ONE",1.1),("TWO",2), ("TWO",2.2)]
    classify = Fold.toMap fst (Fold.lmap snd Fold.toList)
    in Stream.fold classify input :: IO (Map String [Double])
    :}
    fromList [("ONE",[1.0,1.1]),("TWO",[2.0,2.2])]
    
    Once the classifier fold terminates for a particular key any further inputs in that bucket are ignored. Space used is proportional to the number of keys seen till now and monotonically increases because it stores whether a key has been seen or not. See demuxToMap for a more powerful version where you can use a different fold for each key. A simpler version of toMap retaining only the last value for a key can be written as:
    >>> toMap = Fold.foldl' (\kv (k, v) -> Map.insert k v kv) Map.empty
    
    Stops: never Pre-release

  4. toMapIO :: forall (m :: Type -> Type) k a b . (MonadIO m, Ord k) => (a -> k) -> Fold m a b -> Fold m a (Map k b)

    streamly-core Streamly.Internal.Data.Fold

    Same as toMap but maybe faster because it uses mutable cells as fold accumulators in the Map.

  5. windowLmap :: forall c a (m :: Type -> Type) b . (c -> a) -> Fold m (a, Maybe a) b -> Fold m (c, Maybe c) b

    streamly-core Streamly.Internal.Data.Fold

    Map a function on the incoming as well as outgoing element of a rolling window fold.

    >>> lmap f = Fold.lmap (bimap f (f <$>))
    

  6. windowRollingMap :: forall (m :: Type -> Type) a b . Monad m => (Maybe a -> a -> Maybe b) -> Fold m (a, Maybe a) (Maybe b)

    streamly-core Streamly.Internal.Data.Fold

    Apply a pure function on the latest and the oldest element of the window.

    >>> windowRollingMap f = Fold.windowRollingMapM (\x y -> return $ f x y)
    

  7. windowRollingMapM :: Monad m => (Maybe a -> a -> m (Maybe b)) -> Fold m (a, Maybe a) (Maybe b)

    streamly-core Streamly.Internal.Data.Fold

    Apply an effectful function on the latest and the oldest element of the window.

  8. concatMap :: forall (m :: Type -> Type) b a c . Monad m => (b -> ChunkFold m a c) -> ChunkFold m a b -> ChunkFold m a c

    streamly-core Streamly.Internal.Data.Fold.Chunked

    Applies a fold on the input stream, generates the next fold from the output of the previously applied fold and then applies that fold. Pre-release

  9. rmapM :: Monad m => (b -> m c) -> ChunkFold m a b -> ChunkFold m a c

    streamly-core Streamly.Internal.Data.Fold.Chunked

    Map a monadic function on the output of a fold. Pre-release

  10. module Streamly.Internal.Data.IsMap

    No documentation available.

Page 1089 of many | Previous | Next