generald.functions

This module implements a variety of classes derived from Function.

Members

Aliases

ArrayReturn
alias ArrayReturn(A) = RealFunction!(arrayReturn!A)

Return function for Array.

IdentityFunction
alias IdentityFunction(T) = RealFunction!(id!T)

Identity function.

LeftEither
alias LeftEither(A, B) = RealFunction!(left!(B, A))

Function to Either.

Maybe
alias Maybe = Nullable
Undocumented in source.
MaybeReturn
alias MaybeReturn(A) = RealFunction!(maybeReturn!A)

Return function for Maybe.

MaybeTuple
alias MaybeTuple(A, B) = RealFunction!(maybeTuple!(Tuple!(Maybe!A, Maybe!B)))

Function from Tuple of Maybe to Maybe of Tuple.

RightEither
alias RightEither(A, B) = RealFunction!(right!(A, B))

Function to Either.

TupleLeft
alias TupleLeft(A, B) = RealFunction!(tupleLeft!(Tuple!(A, B)))
TupleRight
alias TupleRight(A, B) = RealFunction!(tupleRight!(Tuple!(A, B)))

Function from Tuple.

arrayReturn
alias arrayReturn(A) = arrayOnly!A

Return function for Array.

maybeReturn
alias maybeReturn(A) = just!A

Return function for Maybe.

Classes

ArrayArray
class ArrayArray(A, B)

Take an array of functions and return a function from and to array.

ArrayBind
class ArrayBind(A, B)

Bind function for Array.

ArrayMap
class ArrayMap(A, B)

Map function for Array.

ArraySink
class ArraySink(A)

Function from Array to void can be constructed from a Function to void.

ComposedFunction
class ComposedFunction(A, B, C, D)

Compose two Functions.

CurriedFunction
class CurriedFunction(A, B, C)

Curry a function.

EitherFunction
class EitherFunction(A, B, C)

Tuple of functions, which takes an Either.

Function
class Function(A, B)

A class representing a function.

FunctionArray
class FunctionArray(A, B)

Takues an array of functions and return a function to array.

FunctionEither
class FunctionEither(A, B, C)

Either of functions, which returns an Either.

FunctionTuple
class FunctionTuple(A, B, C)

Tuple of functions, which returns a Tuple.

MaybeBind
class MaybeBind(A, B)

Bind function for Maybe: (a -> Maybe b) -> (Maybe a -> Maybe b).

MaybeNothing
class MaybeNothing(A, B, C = void)

Maybe do something, and return null.

MaybeSink
class MaybeSink(A)

Function from Maybe to void can be constructed from a Function to void.

Printer
class Printer(T)
Undocumented in source.
RealFunction
class RealFunction(alias f, A = ParameterTypeTuple!f[0], B = ReturnType!f)

Template for converting a function to Function instance.

TupleFunction
class TupleFunction(A, B, C)

Either of functions, which takes a Tuple.

UncurriedFunction
class UncurriedFunction(A, B, C)

Uncurry a function.

Functions

arrayArray
auto arrayArray(FS fs)

Take an array of functions and return a function from and to array.

arrayBind
auto arrayBind(F f)

Bind function for Array.

arrayMap
auto arrayMap(F f)

Map function for Array.

arrayOnly
auto arrayOnly(A x)

Return function for Array.

arraySink
auto arraySink(S sink)

Function from Array to void can be constructed from a Function to void.

autoPrint
auto autoPrint(F f)
Undocumented in source. Be warned that the author may not have intended to support it.
autoPrintJustOnly
auto autoPrintJustOnly(F f)
Undocumented in source. Be warned that the author may not have intended to support it.
collatz
Maybe!T collatz(T x)
Undocumented in source. Be warned that the author may not have intended to support it.
compose
auto compose(F f, G g)

Compose two Functions.

curry
auto curry(F f)

Curry a function.

eitherEither
auto eitherEither(F f, G g)

Function from and to Either.

eitherEitherIdentity
auto eitherEitherIdentity(F f)

(a -> b) -> (a|c -> b|c)

eitherFunction
auto eitherFunction(F f, G g)

Tuple of functions, which takes an Either.

eitherFunctionIdentity
auto eitherFunctionIdentity(F f)

(a -> b) -> (a|b -> b)

functionArray
auto functionArray(F[] fs)

Takues an array of functions and return a function to array.

functionEitherLeft
auto functionEitherLeft(F f)
functionEitherRight
auto functionEitherRight(F f)

Either of functions, which returns an Either.

functionTuple
auto functionTuple(F f, G g)

Tuple of functions, which returns a Tuple.

functionTupleIdentity
auto functionTupleIdentity(F f)

(a -> b) -> (a -> (b, a))

id
T id(T x)

Identity function.

increment
T increment(T x)
Undocumented in source. Be warned that the author may not have intended to support it.
just
Maybe!A just(A x)

Return function for Maybe.

left
Either!(A, B) left(A a)

Either!(, B) functor at A.

leftTupleFunction
auto leftTupleFunction(F f)

Either of functions, which takes a Tuple.

maybeBind
auto maybeBind(F f)

Bind function for Maybe: (a -> Maybe b) -> (Maybe a -> Maybe b).

maybeCompose
auto maybeCompose(F f, G g)

Compose two Functions f and g where f emits a Maybe!B and g takes a B.

maybeEqual
bool maybeEqual(Maybe!T x, Maybe!T y)
Undocumented in source. Be warned that the author may not have intended to support it.
maybeMap
auto maybeMap(F f)

Map function for Maybe.

maybeNothing
auto maybeNothing(F f)

Maybe do something, and return null.

maybeSink
auto maybeSink(S sink)

Function from Maybe to void can be constructed from a Function to void.

maybeTuple
auto maybeTuple(TM x)

Function from Tuple of Maybe to Maybe of Tuple.

nothing
Maybe!A nothing()

Function which always return Null.

right
Either!(A, B) right(B b)

Either!(A, ) functor at B.

rightTupleFunction
auto rightTupleFunction(F f)

Either of functions, which takes a Tuple.

swapResult
auto swapResult(F f)

Compose with swapper.

swapper
auto swapper()

Returns the function which swaps the components of the given tuple.

triple
T triple(T x)
Undocumented in source. Be warned that the author may not have intended to support it.
tupleLeft
auto tupleLeft(T x)
tupleRight
auto tupleRight(T x)

Function from Tuple.

tupleTuple
auto tupleTuple(F f, G g)

Function from and to Tuple.

tupleTupleIdentity
auto tupleTupleIdentity(F f)

(a -> b) -> ((a, c) -> (b, c))

uncurry
auto uncurry(F f)

Uncurry a function.

Mixin templates

Singleton
mixintemplate Singleton(Flag!"hideConstructor" hideConstructor = Yes.hideConstructor)

Singleton pattern.

Structs

Either
struct Either(A, B)

Either type.

Meta