Hoogle Search

Within LTS Haskell 24.4 (ghc-9.10.2)

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

  1. mconcat :: Monoid a => [a] -> a

    distribution-opensuse OpenSuse.Prelude

    Fold a list using the monoid. For most types, the default definition for mconcat will be used, but the function is included in the class definition so that an optimized version can be provided for specific types.

    >>> mconcat ["Hello", " ", "Haskell", "!"]
    "Hello Haskell!"
    

  2. mconcatMapM :: (Monad m, Monoid b) => (a -> m b) -> [a] -> m b

    distribution-opensuse OpenSuse.Prelude

    A version of mconcatMap that works with a monadic predicate.

  3. sconcat :: Semigroup a => NonEmpty a -> a

    distribution-opensuse OpenSuse.Prelude

    Reduce a non-empty list with <> The default definition should be sufficient, but this can be overridden for efficiency.

    Examples

    For the following examples, we will assume that we have:
    >>> import Data.List.NonEmpty (NonEmpty (..))
    
    >>> sconcat $ "Hello" :| [" ", "Haskell", "!"]
    "Hello Haskell!"
    
    >>> sconcat $ Just [1, 2, 3] :| [Nothing, Just [4, 5, 6]]
    Just [1,2,3,4,5,6]
    
    >>> sconcat $ Left 1 :| [Right 2, Left 3, Right 4]
    Right 2
    

  4. mconcat :: Monoid a => [a] -> a

    faktory Faktory.Prelude

    Fold a list using the monoid. For most types, the default definition for mconcat will be used, but the function is included in the class definition so that an optimized version can be provided for specific types.

    >>> mconcat ["Hello", " ", "Haskell", "!"]
    "Hello Haskell!"
    

  5. sconcat :: Semigroup a => NonEmpty a -> a

    github GitHub.Internal.Prelude

    Reduce a non-empty list with <> The default definition should be sufficient, but this can be overridden for efficiency.

    Examples

    For the following examples, we will assume that we have:
    >>> import Data.List.NonEmpty (NonEmpty (..))
    
    >>> sconcat $ "Hello" :| [" ", "Haskell", "!"]
    "Hello Haskell!"
    
    >>> sconcat $ Just [1, 2, 3] :| [Nothing, Just [4, 5, 6]]
    Just [1,2,3,4,5,6]
    
    >>> sconcat $ Left 1 :| [Right 2, Left 3, Right 4]
    Right 2
    

  6. parConcat :: forall (m :: Type -> Type) a . MonadAsync m => (Config -> Config) -> Stream m (Stream m a) -> Stream m a

    streamly Streamly.Data.Stream.Prelude

    Evaluate the streams in the input stream concurrently and combine them.

    >>> parConcat modifier = Stream.parConcatMap modifier id
    

  7. parConcatIterate :: forall (m :: Type -> Type) a . MonadAsync m => (Config -> Config) -> (a -> Stream m a) -> Stream m a -> Stream m a

    streamly Streamly.Data.Stream.Prelude

    Same as concatIterate but concurrent. Pre-release

  8. parConcatMap :: forall (m :: Type -> Type) a b . MonadAsync m => (Config -> Config) -> (a -> Stream m b) -> Stream m a -> Stream m b

    streamly Streamly.Data.Stream.Prelude

    Map each element of the input to a stream and then concurrently evaluate and concatenate the resulting streams. Multiple streams may be evaluated concurrently but earlier streams are perferred. Output from the streams are used as they arrive. Definition:

    >>> parConcatMap modifier f stream = Stream.parConcat modifier $ fmap f stream
    
    Examples:
    >>> f cfg xs = Stream.fold Fold.toList $ Stream.parConcatMap cfg id $ Stream.fromList xs
    
    The following streams finish in 4 seconds:
    >>> stream1 = Stream.fromEffect (delay 4)
    
    >>> stream2 = Stream.fromEffect (delay 2)
    
    >>> stream3 = Stream.fromEffect (delay 1)
    
    >>> f id [stream1, stream2, stream3]
    1 sec
    2 sec
    4 sec
    [1,2,4]
    
    Limiting threads to 2 schedules the third stream only after one of the first two has finished, releasing a thread:
    >>> f (Stream.maxThreads 2) [stream1, stream2, stream3]
    ...
    [2,1,4]
    
    When used with a Single thread it behaves like serial concatMap:
    >>> f (Stream.maxThreads 1) [stream1, stream2, stream3]
    ...
    [4,2,1]
    
    >>> stream1 = Stream.fromList [1,2,3]
    
    >>> stream2 = Stream.fromList [4,5,6]
    
    >>> f (Stream.maxThreads 1) [stream1, stream2]
    [1,2,3,4,5,6]
    
    Schedule all streams in a round robin fashion over the available threads:
    >>> f cfg xs = Stream.fold Fold.toList $ Stream.parConcatMap (Stream.interleaved True . cfg) id $ Stream.fromList xs
    
    >>> stream1 = Stream.fromList [1,2,3]
    
    >>> stream2 = Stream.fromList [4,5,6]
    
    >>> f (Stream.maxThreads 1) [stream1, stream2]
    [1,4,2,5,3,6]
    

  9. parConcat :: forall (m :: Type -> Type) a . MonadAsync m => (Config -> Config) -> Stream m (Stream m a) -> Stream m a

    streamly Streamly.Internal.Data.Stream.Prelude

    Evaluate the streams in the input stream concurrently and combine them.

    >>> parConcat modifier = Stream.parConcatMap modifier id
    

  10. parConcatIterate :: forall (m :: Type -> Type) a . MonadAsync m => (Config -> Config) -> (a -> Stream m a) -> Stream m a -> Stream m a

    streamly Streamly.Internal.Data.Stream.Prelude

    Same as concatIterate but concurrent. Pre-release

Page 12 of many | Previous | Next