Monthly Downloads: 11
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Tags: Data    
Latest version: v0.1.0.0

data-foldapp alternatives and similar packages

Based on the "Data" category.
Alternatively, view data-foldapp alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of data-foldapp or a related project?

Add another 'Data' Package



This package provides a framework for constructing variadic functions as folds over function applications.

For example, a variadic function f may be reduced like this:

f a b c
≡ foldlApp @(~) f' z a b c
≡ f' (f' (f' z a) b) c

Both left and right associative folds are available.

This module re-exports Data.FoldApp.Identity which assumes the identity conversion for arguments. Data.FoldApp.Generic provides the generalised folds where a different converter may be given. Conversion allows for folding over differently-typed arguments by converting them to a common type.

Data.FoldApp.Function contains several variadic functions which may be useful as examples or in your programs.

Folds cannot be defined to return functions. This is because the parameters intended for the returned function become confused with the parameters intended for folding. This weakness can be circumvented by wrapping and unwrapping returned functions with a newtype at the cost of inconvenience.

If a type inference problem arises, you possibly need to provide an annotation for some arguments or an annotation for the return type. For example, without any other typing context the following is ambiguous …

listOf "hello" "sailor!"

… because it is not known how many more arguments should be accepted. An annotation such as the following fixes this problem …

listOf "hello" "sailor!" :: String -> [String]

… saying one more String argument must be given and a [String] will be returned.