fpdart library

Classes

Compose<Input, Output>
Compose a series of functions, the output of the previous function in the chain is automatically passed as input to the next function in the chain.
Compose2<Input1, Input2, Output>
Compose a series of functions, the output of the previous function in the chain is automatically passed as input to the next function in the chain.
Either<L, R>
Represents a value of one of two possible types, Left or Right.
Eq<T>
A type class used to determine equality between 2 instances of the same type T. Any 2 instances x and y are equal if eqv(x, y) is true.
Hash<T>
A type class used to represent a hashing scheme for objects of a given type.
HKT<G, A>
https://marcosh.github.io/post/2020/04/15/higher-kinded-types-php-solution.html https://medium.com/@gcanti/higher-kinded-types-in-flow-275b657992b7
HKT2<G1, G2, A>
IO<A>
IO<A> represents a non-deterministic synchronous computation that can cause side effects, yields a value of type A and never fails.
IOEither<L, R>
IOEither<L, R> represents a non-deterministic synchronous computation that can cause side effects, yields a value of type R or can fail by returning a value of type L.
IOOption<R>
IOOption<R> represents an synchronous computation that may fails yielding a None or returns a Some(R) when successful.
IORef<T>
Mutable reference in the IO monad.
Left<L, R>
None
Option<T>
A type that can contain a value of type T in a Some or no value with None.
Order<T>
The Order type class is used to define a total ordering on some type A.
PartialOrder<T>
The PartialOrder type class is used to define a partial ordering on some type A.
Predicate<T>
Compose functions that given a generic value T return a bool.
Reader<R, A>
Reader<R, A> allows to read values A from a dependency/context R without explicitly passing the dependency between multiple nested function calls.
ReaderHKT
Tag the HKT2 interface for the actual Reader.
Some<T>
State<S, A>
State<S, A> is used to store, update, and extract state in a functional way.
StateAsync<S, A>
StateAsync<S, A> is used to store, update, and extract async state in a functional way.
Task<A>
Task represents an asynchronous computation that yields a value of type A and never fails.
TaskEither<L, R>
TaskEither<L, R> represents an asynchronous computation that either yields a value of type R or fails yielding an error of type L.
TaskOption<R>
TaskOption<R> represents an asynchronous computation that may fails yielding a None or returns a Some(R) when successful.
Tuple2<T1, T2>
Tuple2<T1, T2> is a type that contains a value of type T1 and a value of type T2.
Unit
Used instead of void as a return statement for a function when no value is to be returned.

Mixins

Alt<KT, A>
Alt type class identifies an associative operation on a type constructor.
Alt2<KT, A, B>
Applicative<G, A>
Applicative2<G, A, B>
Band<T>
Bands are semigroups whose operation (i.e. combine) is also idempotent (an operation that can be applied multiple times without changing the result beyond the initial application).
BoundedSemilattice<T>
A semilattice in which:
CommutativeGroup<T>
An commutative group (also known as an abelian group) is a group whose combine operation is commutative.
CommutativeMonoid<T>
CommutativeMonoid represents a commutative monoid.
CommutativeSemigroup<T>
CommutativeSemigroup represents a commutative semigroup.
Extend<KT, A>
Extend2<KT, A, B>
Filterable<KT, A>
Foldable<G, A>
Foldable2<G, A, B>
Functor<G, A>
Functor<G, A> extends HKT<G, A> to express the fact that the classes implementing the Functor interface will need to be higher kinded types.
Functor2<G, A, B>
Group<T>
A group is a monoid where each element has an inverse.
Monad<KT, A>
Monad2<KT, A, B>
Monoid<T>
A monoid is a semigroup with an identity (empty).
Semigroup<T>
A semigroup is any set A with an associative operation (combine).
Semilattice<T>
Semilattices are commutative semigroups whose operation (i.e. combine) is also idempotent.

Extensions

ComposeOnFunction1 on Output Function(Input)
ComposeOnFunction2 on Output Function(Input1, Input2)
CurryExtension2 on Output Function(Input1, Input2)
CurryExtension3 on Output Function(Input1, Input2, Input3)
CurryExtension4 on Output Function(Input1, Input2, Input3, Input4)
CurryExtension5 on Output Function(Input1, Input2, Input3, Input4, Input5)
FpdartBoolean on bool
fpdart extension methods on bool
FpdartDateTime on DateTime
fpdart extension methods on DateTime
FpdartOnMutableIterable on Iterable<T>
Functional programming functions on a mutable dart Iterable using fpdart.
FpdartOnMutableIterableOfIterable on Iterable<Iterable<T>>
Functional programming functions on a mutable dart Iterable<Iterable<T>> using fpdart.
FpdartOnMutableMap on Map<K, V>
Functional programming functions on a mutable dart Map using fpdart.
FpdartOnNullable on T?
fpdart extension to work on nullable values T?
FpdartOnOptionMutableMap on Option<Map<K, dynamic>>
FpdartSequenceIterableEither on Iterable<Either<E, A>>
FpdartSequenceIterableIO on Iterable<IO<T>>
FpdartSequenceIterableIOEither on Iterable<IOEither<E, T>>
FpdartSequenceIterableIOOption on Iterable<IOOption<T>>
FpdartSequenceIterableOption on Iterable<Option<T>>
FpdartSequenceIterableTask on Iterable<Task<T>>
FpdartSequenceIterableTaskEither on Iterable<TaskEither<E, T>>
FpdartSequenceIterableTaskOption on Iterable<TaskOption<T>>
FpdartTraversableIterable on Iterable<T>
OptionExtension on Option<T>
UncurryExtension2 on Output Function(Input2) Function(Input1)
UncurryExtension3 on Output Function(Input3) Function(Input2) Function(Input1)
UncurryExtension4 on Output Function(Input4) Function(Input3) Function(Input2) Function(Input1)
UncurryExtension5 on Output Function(Input5) Function(Input4) Function(Input3) Function(Input2) Function(Input1)

Constants

unit → const Unit
Used instead of void as a return statement for a function when no value is to be returned.

Properties

dateEqDay Eq<DateTime>
Eq instance to compare DateTime days.
final
dateEqMonth Eq<DateTime>
Eq instance to compare DateTime months.
final
dateEqYear Eq<DateTime>
Eq instance to compare DateTime years.
final
dateEqYearMonthDay Eq<DateTime>
Eq instance to compare DateTime by year, month, and day.
final
dateOrder Order<DateTime>
Order instance on dart DateTime.
final
ioRefEq Eq<IORef<Object?>>
Eq instance to compare IORefs using pointer equality
final

Functions

boolAndMonoid() Monoid<bool>
boolOrMonoid() Monoid<bool>
constF<A>(A a) → A Function(dynamic b)
constf a is a unary function which evaluates to a for all inputs.
curry2<FirstParameter, SecondParameter, ReturnType>(ReturnType function(FirstParameter first, SecondParameter second)) → ReturnType Function(SecondParameter second) Function(FirstParameter first)
Converts a binary function into a unary function that returns a unary function.
curry3<A, B, C, D>(D function(A a, B b, C c)) → D Function(C c) Function(B b) Function(A a)
Converts a ternary function into unary functions.
curry4<A, B, C, D, E>(E function(A a, B b, C c, D d)) → E Function(D d) Function(C c) Function(B b) Function(A a)
Converts a 4 parameters function into unary functions.
curry5<A, B, C, D, E, F>(F function(A a, B b, C c, D d, E e)) → F Function(E e) Function(D d) Function(C c) Function(B b) Function(A a)
Converts a 5 parameters function into unary functions.
dateNow() IO<DateTime>
Constructs a DateTime instance with current date and time in the local time zone.
dualEndoMonoid<A>() Monoid<Endo<A>>
endoMonoid<A>() Monoid<Endo<A>>
id<T>(T a) → T
Returns the given a.
identity<T>(T a) → T
Returns the given a.
identityFuture<T>(T a) Future<T>
Returns the given a, wrapped in Future.value.
idFirst<T1, T2>(T1 t1, T2 t2) → T1
Returns the first parameter from a function that takes two parameters as input.
idFuture<T>(T a) Future<T>
Returns the given a, wrapped in Future.value.
idSecond<T1, T2>(T1 t1, T2 t2) → T2
Returns the second parameter from a function that takes two parameters as input.
left<L, R>(L l) Either<L, R>
Return a Left(l).
modifyIORef<T>(Endo<T> update, IORef<T> ref) IO<Unit>
Works almost identical to the write method, but instead of taking a value that needs to be written, takes an Endo function, applies the IORef's current value to it and writes the result to the IORef.
modifyIORefC<T>(Endo<T> update) IO<Unit> Function(IORef<T> ref)
A curried version of the modifyIORef
newIORef<T>(T initial) IO<IORef<T>>
Creates a new IORef inside an IO monad with a given initial value.
none<T>() Option<T>
Return a None.
now() IO<int>
The number of milliseconds since the "Unix epoch" 1970-01-01T00:00:00Z (UTC).
option<T>(T value, bool predicate(T)) Option<T>
Return Some of value when predicate applied to value returns true, None otherwise.
optionOf<T>(T? t) Option<T>
Return None if t is null, Some otherwise.
random() IO<double>
Generates a non-negative random floating point value uniformly distributed in the range from 0.0, inclusive, to 1.0, exclusive.
randomBool() IO<bool>
Generates a random boolean value.
randomInt(int min, int max) IO<int>
Generates a non-negative random integer uniformly distributed in the range from min, inclusive, to max, exclusive.
readIORef<T>(IORef<T> ref) IO<T>
Extracts a current value of the IORef and returns it inside the IO monad.
Return a Right(r).
some<T>(T t) Option<T>
Return a Some(t).
tuple2<A, B>(A a, B b) Tuple2<A, B>
Return a Tuple2(a, b).
tuple2CurriedFirst<A, B>(A a) Tuple2<A, B> Function(B b)
Build a Tuple2(a, b) using a curried function in which the first function accepts a and the second function accepts b.
tuple2CurriedSecond<A, B>(B b) Tuple2<A, B> Function(A a)
Build a Tuple2(a, b) using a curried function in which the first function accepts b and the second function accepts a.
uncurry2<A, B, C>(C Function(B a) function(A a)) → C Function(A a, B b)
Converts a unary function that returns a unary function into a binary function.
uncurry3<A, B, C, D>(D Function(C c) Function(B b) function(A a)) → D Function(A a, B b, C c)
Converts a series of unary functions into a ternary function.
uncurry4<A, B, C, D, E>(E Function(D d) Function(C c) Function(B b) function(A a)) → E Function(A a, B b, C c, D d)
Converts a series of unary functions into a 4 parameters function.
uncurry5<A, B, C, D, E, F>(F Function(E e) Function(D d) Function(C c) Function(B b) function(A a)) → F Function(A a, B b, C c, D d, E e)
Converts a series of unary functions into a 5 parameters function.
writeIORef<T>(T value, IORef<T> ref) IO<Unit>
Writes the given value to the IORef and returns a Unit inside the IO monad.
writeIORefC<T>(T value) IO<Unit> Function(IORef<T> ref)
A curried version of the writeIORef

Typedefs

DoAdapterEither<L> = R Function<R>(Either<L, R>)
DoAdapterIO = A Function<A>(IO<A>)
DoAdapterIOEither<E> = A Function<A>(IOEither<E, A>)
DoAdapterIOOption = A Function<A>(IOOption<A>)
DoAdapterOption = A Function<A>(Option<A>)
DoAdapterTask = Future<A> Function<A>(Task<A>)
DoAdapterTaskEither<E> = Future<A> Function<A>(TaskEither<E, A>)
DoAdapterTaskOption = Future<A> Function<A>(TaskOption<A>)
DoFunctionEither<L, R> = R Function(DoAdapterEither<L> $)
DoFunctionIO<A> = A Function(DoAdapterIO $)
DoFunctionIOEither<L, A> = A Function(DoAdapterIOEither<L> $)
DoFunctionIOOption<A> = A Function(DoAdapterIOOption $)
DoFunctionOption<A> = A Function(DoAdapterOption $)
DoFunctionTask<A> = Future<A> Function(DoAdapterTask $)
DoFunctionTaskEither<L, A> = Future<A> Function(DoAdapterTaskEither<L> $)
DoFunctionTaskOption<A> = Future<A> Function(DoAdapterTaskOption $)
Endo<A> = A Function(A a)
Magma<T> = T Function(T x, T y)
Separated<KT, A, B> = Tuple2<HKT<KT, A>, HKT<KT, B>>