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. data FoldlSym2 (a6989586621680407056 :: b ~> a ~> b) (a6989586621680407057 :: b) (c :: TyFun t a b)

    singletons-base Prelude.Singletons

    No documentation available.

  2. type family FoldlSym3 (a6989586621680407056 :: b ~> a ~> b) (a6989586621680407057 :: b) (a6989586621680407058 :: t a) :: b

    singletons-base Prelude.Singletons

    No documentation available.

  3. bifoldl :: Bifoldable p => (c -> a -> c) -> (c -> b -> c) -> c -> p a b -> c

    rio RIO.Prelude

    Combines the elements of a structure in a left associative manner. Given a hypothetical function toEitherList :: p a b -> [Either a b] yielding a list of all elements of a structure in order, the following would hold:

    bifoldl f g z
    ≡ foldl (acc -> either (f acc) (g acc)) z . toEitherList
    
    Note that if you want an efficient left-fold, you probably want to use bifoldl' instead of bifoldl. The reason is that the latter does not force the "inner" results, resulting in a thunk chain which then must be evaluated from the outside-in.

    Examples

    Basic usage:
    > bifoldl (+) (*) 3 (5, 7)
    56 -- (5 + 3) * 7
    
    > bifoldl (+) (*) 3 (7, 5)
    50 -- (7 + 3) * 5
    
    > bifoldl (+) (*) 3 (Right 5)
    15 -- 5 * 3
    
    > bifoldl (+) (*) 3 (Left 5)
    8 -- 5 + 3
    

  4. bifoldl' :: Bifoldable t => (a -> b -> a) -> (a -> c -> a) -> a -> t b c -> a

    rio RIO.Prelude

    As bifoldl, but strict in the result of the reduction functions at each step. This ensures that each step of the bifold 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, monolithic result (e.g., bilength).

  5. bifoldl1 :: Bifoldable t => (a -> a -> a) -> t a a -> a

    rio RIO.Prelude

    A variant of bifoldl that has no base case, and thus may only be applied to non-empty structures.

    Examples

    Basic usage:
    >>> bifoldl1 (+) (5, 7)
    12
    
    >>> bifoldl1 (+) (Right 7)
    7
    
    >>> bifoldl1 (+) (Left 5)
    5
    
    > bifoldl1 (+) (BiList [1, 2] [3, 4])
    10 -- ((1 + 2) + 3) + 4
    
    >>> bifoldl1 (+) (BiList [1, 2] [])
    3
    
    On empty structures, this function throws an exception:
    >>> bifoldl1 (+) (BiList [] [])
    *** Exception: bifoldl1: empty structure
    ...
    

  6. bifoldlM :: (Bifoldable t, Monad m) => (a -> b -> m a) -> (a -> c -> m a) -> a -> t b c -> m a

    rio RIO.Prelude

    Left associative monadic bifold over a structure.

    Examples

    Basic usage:
    >>> bifoldlM (\a b -> print b >> pure a) (\a c -> print (show c) >> pure a) 42 ("Hello", True)
    "Hello"
    "True"
    42
    
    >>> bifoldlM (\a b -> print b >> pure a) (\a c -> print (show c) >> pure a) 42 (Right True)
    "True"
    42
    
    >>> bifoldlM (\a b -> print b >> pure a) (\a c -> print (show c) >> pure a) 42 (Left "Hello")
    "Hello"
    42
    

  7. gfoldl :: Data a => (forall d b . Data d => c (d -> b) -> d -> c b) -> (forall g . () => g -> c g) -> a -> c a

    rio RIO.Prelude.Types

    Left-associative fold operation for constructor applications. The type of gfoldl is a headache, but operationally it is a simple generalisation of a list fold. The default definition for gfoldl is const id, which is suitable for abstract datatypes with no substructures.

  8. ifoldl :: FoldableWithIndex i f => (i -> b -> a -> b) -> b -> f a -> b

    diagrams-lib Diagrams.Prelude

    Left-associative fold of an indexed container with access to the index i. When you don't need access to the index then foldl is more flexible in what it accepts.

    foldlifoldl . const
    

  9. ifoldl' :: FoldableWithIndex i f => (i -> b -> a -> b) -> b -> f a -> b

    diagrams-lib Diagrams.Prelude

    Fold over the elements of a structure with an index, associating to the left, but strictly. When you don't need access to the index then foldlOf' is more flexible in what it accepts.

    foldl' l ≡ ifoldl' l . const
    

  10. ifoldlM :: (FoldableWithIndex i f, Monad m) => (i -> b -> a -> m b) -> b -> f a -> m b

    diagrams-lib Diagrams.Prelude

    Monadic fold over the elements of a structure with an index, associating to the left. When you don't need access to the index then foldlM is more flexible in what it accepts.

    foldlMifoldlM . const
    

Page 9 of many | Previous | Next