treefold-0.1.0.0: Provides folds which try to combine elements in a balanced way.

Safe HaskellSafe
LanguageHaskell2010

Data.TreeFold.Foldable

Description

This module provides folds which try to combine elements in a balanced way. These can be useful for constructing balanced binary trees, or more stable summation.

Adapted from here.

This is a version of Data.TreeFold which works on any Foldable container, rather than just lists.

Synopsis

Documentation

treeFold :: Foldable f => (a -> a -> a) -> a -> f a -> a Source #

A version of treeFold which works on any Foldable.

treeFoldMap :: Foldable f => (b -> a) -> (a -> a -> a) -> a -> f b -> a Source #

A version of treeFoldMap which works on any Foldable.