variadic-function-0.1.0.2: Create and transform functions with variable arity.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Function.Variadic.Utils

Synopsis

Documentation

composeN :: (Function f args b EmptyConstraint, Function g args a EmptyConstraint) => (a -> b) -> g -> f Source #

Function composition for an arbitrary number of arguments.

>>> (show `composeN` \a b c -> (a + b + c :: Int)) 1 2 3
"6"

constN :: Function f args a EmptyConstraint => a -> f Source #

Constant function for an arbitrary number of arguments.

let const2 = constN :: x -> a -> b -> x
>>> zipWith3 (constN 1) [1..10] [1..5] ["a", "b", "c"] :: [Int]
[1,1,1]

mappendN :: forall r f args. (Function f args r ((~) r), Monoid r) => f Source #

Append multiple monoid values. It is similar to mconcat but takes the values as arguments rather than list elements.

>>> mappendN [1, 2] [3] [4, 5] :: [Int]
[1,2,3,4,5]