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. foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b

    dimensional Numeric.Units.Dimensional.Prelude

    Left-associative fold of a structure but with strict application of the operator. This ensures that each step of the fold is forced to Weak Head Normal Form before being applied, avoiding the collection of thunks that would otherwise occur. This is often what you want to strictly reduce a finite structure to a single strict result (e.g. sum). For a general Foldable structure this should be semantically identical to,

    foldl' f z = foldl' f z . toList
    

  2. foldl1 :: Foldable t => (a -> a -> a) -> t a -> a

    dimensional Numeric.Units.Dimensional.Prelude

    A variant of foldl that has no base case, and thus may only be applied to non-empty structures. This function is non-total and will raise a runtime exception if the structure happens to be empty.

    foldl1 f = foldl1 f . toList
    

    Examples

    Basic usage:
    >>> foldl1 (+) [1..4]
    10
    
    >>> foldl1 (+) []
    *** Exception: Prelude.foldl1: empty list
    
    >>> foldl1 (+) Nothing
    *** Exception: foldl1: empty structure
    
    >>> foldl1 (-) [1..4]
    -8
    
    >>> foldl1 (&&) [True, False, True, True]
    False
    
    >>> foldl1 (||) [False, False, True, True]
    True
    
    >>> foldl1 (+) [1..]
    * Hangs forever *
    

  3. foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b

    distribution-opensuse OpenSuse.Prelude

    Left-associative fold of a structure but with strict application of the operator. This ensures that each step of the fold is forced to Weak Head Normal Form before being applied, avoiding the collection of thunks that would otherwise occur. This is often what you want to strictly reduce a finite structure to a single strict result (e.g. sum). For a general Foldable structure this should be semantically identical to,

    foldl' f z = foldl' f z . toList
    

  4. foldl1 :: Foldable t => (a -> a -> a) -> t a -> a

    distribution-opensuse OpenSuse.Prelude

    A variant of foldl that has no base case, and thus may only be applied to non-empty structures. This function is non-total and will raise a runtime exception if the structure happens to be empty.

    foldl1 f = foldl1 f . toList
    

    Examples

    Basic usage:
    >>> foldl1 (+) [1..4]
    10
    
    >>> foldl1 (+) []
    *** Exception: Prelude.foldl1: empty list
    
    >>> foldl1 (+) Nothing
    *** Exception: foldl1: empty structure
    
    >>> foldl1 (-) [1..4]
    -8
    
    >>> foldl1 (&&) [True, False, True, True]
    False
    
    >>> foldl1 (||) [False, False, True, True]
    True
    
    >>> foldl1 (+) [1..]
    * Hangs forever *
    

  5. foldl' :: Monad m => (b -> a -> b) -> b -> SerialT m a -> m b

    streamly Streamly.Prelude

    Left associative/strict push fold. foldl' reduce initial stream invokes reduce with the accumulator and the next input in the input stream, using initial as the initial value of the current value of the accumulator. When the input is exhausted the current value of the accumulator is returned. Make sure to use a strict data structure for accumulator to not build unnecessary lazy expressions unless that's what you want. See the previous section for more details.

  6. foldl1' :: Monad m => (a -> a -> a) -> SerialT m a -> m (Maybe a)

    streamly Streamly.Prelude

    Strict left fold, for non-empty streams, using first element as the starting value. Returns Nothing if the stream is empty.

  7. foldlM' :: Monad m => (b -> a -> m b) -> m b -> SerialT m a -> m b

    streamly Streamly.Prelude

    Like foldl' but with a monadic step function. Since: 0.2.0 Since: 0.8.0 (signature change)

  8. foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b

    constrained-categories Control.Category.Constrained.Prelude

    Left-associative fold of a structure but with strict application of the operator. This ensures that each step of the fold is forced to Weak Head Normal Form before being applied, avoiding the collection of thunks that would otherwise occur. This is often what you want to strictly reduce a finite structure to a single strict result (e.g. sum). For a general Foldable structure this should be semantically identical to,

    foldl' f z = foldl' f z . toList
    

  9. foldl1 :: Foldable t => (a -> a -> a) -> t a -> a

    constrained-categories Control.Category.Constrained.Prelude

    A variant of foldl that has no base case, and thus may only be applied to non-empty structures. This function is non-total and will raise a runtime exception if the structure happens to be empty.

    foldl1 f = foldl1 f . toList
    

    Examples

    Basic usage:
    >>> foldl1 (+) [1..4]
    10
    
    >>> foldl1 (+) []
    *** Exception: Prelude.foldl1: empty list
    
    >>> foldl1 (+) Nothing
    *** Exception: foldl1: empty structure
    
    >>> foldl1 (-) [1..4]
    -8
    
    >>> foldl1 (&&) [True, False, True, True]
    False
    
    >>> foldl1 (||) [False, False, True, True]
    True
    
    >>> foldl1 (+) [1..]
    * Hangs forever *
    

  10. foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b

    copilot-language Copilot.Language.Prelude

    Left-associative fold of a structure but with strict application of the operator. This ensures that each step of the fold is forced to Weak Head Normal Form before being applied, avoiding the collection of thunks that would otherwise occur. This is often what you want to strictly reduce a finite structure to a single strict result (e.g. sum). For a general Foldable structure this should be semantically identical to,

    foldl' f z = foldl' f z . toList
    

Page 7 of many | Previous | Next