Crate rust2fun

Source
Expand description

A library for functional programming in Rust

Modules§

and_then
AndThen.
ap_n
ApN.
applicative
Applicative functor. Allows application of a function in an Applicative context to a value in an Applicative context.
apply
Apply.
bifunctor
Bifunctor is a type constructor that takes two type arguments and is a functor in both arguments.
combinator
Combinators
contravariant
Contravariant functors.
data
Data types.
flatmap
FlatMap.
functor
Functor. The name is short for “covariant functor”.
higher
Implementation of Higher Kinded Types for Rust.
invariant
Invariant functors.
map_n
MapN.
monad
Monad.
monoid
Monoid.
prelude
Convenience re-export of common members of the library.
pure
Pure.
semigroup
Semigroup.
semigroupal
Semigroupal.

Macros§

and_then_flat_map
Macro to implement AndThen for types implementing a FlatMap::flat_map.
apply_iter
Macro to implement Apply for types with Iterator support.
bind
Bind macro. Allows for a more natural syntax for monadic composition. It is similar to the do notation in Haskell or the for notation in Scala.
compose
Compose functions.
constant
The constant with no arguments constant(x) = () -> x.
constant1
The constant function constant1(x) = _ -> x also known as K (Kestrel) combinator.
constant2
The constant function with two arguments constant2(x) = (_, _) -> x.
constant3
The constant function with 3 arguments constant3(x) = (_, _, _) -> x.
constant4
The constant function with 4 arguments constant4(x) = (_, _, _, _) -> x.
constant5
The constant function with 5 arguments constant5(x) = (_, _, _, _, _) -> x.
constant6
The constant function with 6 arguments constant6(x) = (_, _, _, _, _, _) -> x.
constant7
The constant function with 7 arguments constant7(x) = (_, _, _, _, _, _, _) -> x.
constant8
The constant function with 8 arguments constant8(x) = (_, _, _, _, _, _, _, _) -> x.
constant9
The constant function with 9 arguments constant9(x) = (_, _, _, _, _, _, _, _, _) -> x.
constant10
The constant function with 10 arguments constant10(x) = (_, _, _, _, _, _, _, _, _, _) -> x.
constant11
The constant function with 11 arguments constant11(x) = (_, _, _, _, _, _, _, _, _, _, _) -> x.
constant12
The constant function with 12 arguments constant12(x) = (_, _, _, _, _, _, _, _, _, _, _, _) -> x.
curry2
Curry a function of two arguments. The first argument is applied to the function. The second argument is returned as a closure. The returned closure can be applied to the second argument. The result is the same as applying the function to both arguments.
curry3
Curry a function of 3 arguments.
curry4
Curry a function of 4 arguments.
curry5
Curry a function of 5 arguments.
curry6
Curry a function of 6 arguments.
curry7
Curry a function of 7 arguments.
curry8
Curry a function of 8 arguments.
curry9
Curry a function of 9 arguments.
curry10
Curry a function of 10 arguments.
curry11
Curry a function of 11 arguments.
curry12
Curry a function of 12 arguments.
flatmap_iter
Macro to implement FlatMap for types with Iterator support.
flip
Flip arguments of a function flip(f)(x, y) = f(y, x) also known as C (Cardinal) combinator.
functor_iter
Macro to implement Functor for types with Iterator support.
higher
Macro implementing Higher for a given type of kind * -> *.
invariant_contravariant
Macro to implement Invariant for types implementing a contravariant Functor.
invariant_functor
Macro to implement Invariant for types implementing Functor.
ne_vec
Creates a NEVec containing the arguments.
pipe
Pipe functions.
semigroup_append
Macro to implement Semigroup for types with append method.
semigroup_extend
Macro to implement Semigroup for types with extend method.
semigroupal_iter
Macro to implement Semigroupal for types with Iterator support.