Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

This module provides strict versions of the functions from Data.TreeFold.

- treeFold :: (a -> a -> a) -> a -> [a] -> a
- treeFoldMap :: (b -> a) -> (a -> a -> a) -> a -> [b] -> a
- treeFoldNonEmpty :: (a -> a -> a) -> NonEmpty a -> a
- treeFoldMapNonEmpty :: (b -> a) -> (a -> a -> a) -> NonEmpty b -> a

# Documentation

`>>>`

data Tree a = Empty | Leaf a | Tree a :*: Tree a deriving Show :}`:{`

treeFold :: (a -> a -> a) -> a -> [a] -> a Source #

A strict version of `treeFold`

.

`>>>`

(Leaf 1 :*: Leaf 2) :*: (Leaf 3 :*: Leaf 4)`(treeFold (:*:) Empty . map Leaf) [1,2,3,4]`

`>>>`

((Leaf 1 :*: Leaf 2) :*: (Leaf 3 :*: Leaf 4)) :*: Leaf 5`(treeFold (:*:) Empty . map Leaf) [1,2,3,4,5]`

`>>>`

99.0`treeFold (+) 0 (replicate 10 9.9)`

treeFoldMap :: (b -> a) -> (a -> a -> a) -> a -> [b] -> a Source #

A strict version of `treeFoldMap`

.

`>>>`

(Leaf 1 :*: Leaf 2) :*: (Leaf 3 :*: Leaf 4)`treeFoldMap Leaf (:*:) Empty [1,2,3,4]`

treeFoldNonEmpty :: (a -> a -> a) -> NonEmpty a -> a Source #

A strict version of `treeFoldNonEmpty`

.

treeFoldMapNonEmpty :: (b -> a) -> (a -> a -> a) -> NonEmpty b -> a Source #

A strict version of `treeFoldMapNonEmpty`

.