utility-ht-0.0.14: Various small helper functions for Lists, Maybes, Tuples, Functions

Safe HaskellSafe
LanguageHaskell98

Data.Function.HT

Synopsis

Documentation

type Id a = a -> a Source #

Useful for adding type annotations like in

f . (id :: Id Char) . g

nest :: Int -> (a -> a) -> a -> a Source #

Compositional power of a function, i.e. apply the function n times to a value. It is rather the same as iter in Simon Thompson: "The Craft of Functional Programming", page 172

powerAssociative :: (a -> a -> a) -> a -> a -> Integer -> a Source #

powerAssociative is an auxiliary function that, for an associative operation op, computes the same value as

powerAssociative op a0 a n = foldr op a0 (genericReplicate n a)

but applies "op" O(log n) times and works for large n.

compose2 :: (b -> b -> c) -> (a -> b) -> a -> a -> c Source #

Known as on in newer versions of the base package.