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. 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.Data.Fold

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

  2. lmap :: forall a b (m :: Type -> Type) r . (a -> b) -> Parser b m r -> Parser a m r

    streamly-core Streamly.Data.Parser

    lmap f parser maps the function f on the input of the parser.

    >>> Stream.parse (Parser.lmap (\x -> x * x) (Parser.fromFold Fold.sum)) (Stream.enumerateFromTo 1 100)
    Right 338350
    
    lmap = Parser.lmapM return
    

  3. lmapM :: Monad m => (a -> m b) -> Parser b m r -> Parser a m r

    streamly-core Streamly.Data.Parser

    lmapM f parser maps the monadic function f on the input of the parser.

  4. rmapM :: Monad m => (b -> m c) -> Parser a m b -> Parser a m c

    streamly-core Streamly.Data.Parser

    rmapM f parser maps the monadic function f on the output of the parser.

    >>> rmap = fmap
    

  5. concatMap :: forall (m :: Type -> Type) a b . Monad m => (a -> Stream m b) -> Stream m a -> Stream m b

    streamly-core Streamly.Data.Stream

    Map a stream producing function on each element of the stream and then flatten the results into a single stream.

    >>> concatMap f = Stream.concatMapM (return . f)
    
    >>> concatMap f = Stream.concat . fmap f
    
    >>> concatMap f = Stream.unfoldMany (Unfold.lmap f Unfold.fromStream)
    
    See unfoldMany for a fusible alternative.

  6. concatMapM :: Monad m => (a -> m (Stream m b)) -> Stream m a -> Stream m b

    streamly-core Streamly.Data.Stream

    Map a stream producing monadic function on each element of the stream and then flatten the results into a single stream. Since the stream generation function is monadic, unlike concatMap, it can produce an effect at the beginning of each iteration of the inner loop. See unfoldMany for a fusible alternative.

  7. concatMapWith :: forall (m :: Type -> Type) b a . (StreamK m b -> StreamK m b -> StreamK m b) -> (a -> StreamK m b) -> StreamK m a -> StreamK m b

    streamly-core Streamly.Data.StreamK

    Perform a concatMap using a specified concat strategy. The first argument specifies a merge or concat function that is used to merge the streams generated by the map function.

  8. mergeMapWith :: forall (m :: Type -> Type) b a . (StreamK m b -> StreamK m b -> StreamK m b) -> (a -> StreamK m b) -> StreamK m a -> StreamK m b

    streamly-core Streamly.Data.StreamK

    Combine streams in pairs using a binary combinator, the resulting streams are then combined again in pairs recursively until we get to a single combined stream. The composition would thus form a binary tree. For example, you can sort a stream using merge sort like this:

    >>> s = StreamK.fromStream $ Stream.fromList [5,1,7,9,2]
    
    >>> generate = StreamK.fromPure
    
    >>> combine = StreamK.mergeBy compare
    
    >>> Stream.fold Fold.toList $ StreamK.toStream $ StreamK.mergeMapWith combine generate s
    [1,2,5,7,9]
    
    Note that if the stream length is not a power of 2, the binary tree composed by mergeMapWith would not be balanced, which may or may not be important depending on what you are trying to achieve. Caution: the stream of streams must be finite Pre-release

  9. lmap :: forall a c (m :: Type -> Type) b . (a -> c) -> Unfold m c b -> Unfold m a b

    streamly-core Streamly.Data.Unfold

    Map a function on the input argument of the Unfold.

    >>> u = Unfold.lmap (fmap (+1)) Unfold.fromList
    
    >>> Unfold.fold Fold.toList u [1..5]
    [2,3,4,5,6]
    
    lmap f = Unfold.many (Unfold.function f)
    

  10. lmapM :: Monad m => (a -> m c) -> Unfold m c b -> Unfold m a b

    streamly-core Streamly.Data.Unfold

    Map an action on the input argument of the Unfold.

    lmapM f = Unfold.many (Unfold.functionM f)
    

Page 1087 of many | Previous | Next