Hoogle Search

Within LTS Haskell 24.3 (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

    base 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

    base 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

    hedgehog Hedgehog.Internal.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

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

    ghc GHC.Prelude.Basic

    No documentation available.

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

    ghc GHC.Prelude.Basic

    No documentation available.

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

    rio RIO.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
    

  8. foldl1Of :: HasCallStack => Getting (Dual (Endo (Maybe a))) s a -> (a -> a -> a) -> s -> a

    diagrams-lib Diagrams.Prelude

    A variant of foldlOf that has no base case and thus may only be applied to lenses and structures such that the Lens views at least one element of the structure.

    >>> foldl1Of each (+) (1,2,3,4)
    10
    
    foldl1Of l f ≡ foldl1 f . toListOf l
    foldl1foldl1Of folded
    
    foldl1Of :: Getter s a     -> (a -> a -> a) -> s -> a
    foldl1Of :: Fold s a       -> (a -> a -> a) -> s -> a
    foldl1Of :: Iso' s a       -> (a -> a -> a) -> s -> a
    foldl1Of :: Lens' s a      -> (a -> a -> a) -> s -> a
    foldl1Of :: Traversal' s a -> (a -> a -> a) -> s -> a
    

  9. foldl1Of' :: HasCallStack => Getting (Endo (Endo (Maybe a))) s a -> (a -> a -> a) -> s -> a

    diagrams-lib Diagrams.Prelude

    A variant of foldlOf' that has no base case and thus may only be applied to folds and structures such that the fold views at least one element of the structure.

    foldl1Of' l f ≡ foldl1' f . toListOf l
    
    foldl1Of' :: Getter s a     -> (a -> a -> a) -> s -> a
    foldl1Of' :: Fold s a       -> (a -> a -> a) -> s -> a
    foldl1Of' :: Iso' s a       -> (a -> a -> a) -> s -> a
    foldl1Of' :: Lens' s a      -> (a -> a -> a) -> s -> a
    foldl1Of' :: Traversal' s a -> (a -> a -> a) -> s -> a
    

  10. foldlMOf :: Monad m => Getting (Endo (r -> m r)) s a -> (r -> a -> m r) -> r -> s -> m r

    diagrams-lib Diagrams.Prelude

    Monadic fold over the elements of a structure, associating to the left, i.e. from left to right.

    foldlMfoldlMOf folded
    
    foldlMOf :: Monad m => Getter s a     -> (r -> a -> m r) -> r -> s -> m r
    foldlMOf :: Monad m => Fold s a       -> (r -> a -> m r) -> r -> s -> m r
    foldlMOf :: Monad m => Iso' s a       -> (r -> a -> m r) -> r -> s -> m r
    foldlMOf :: Monad m => Lens' s a      -> (r -> a -> m r) -> r -> s -> m r
    foldlMOf :: Monad m => Traversal' s a -> (r -> a -> m r) -> r -> s -> m r
    

Page 3 of many | Previous | Next