fpdart
library
Classes
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 >
HKT3 <G1 , G2 , G3 , 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
.
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 .
ReaderTask <E , A >
ReaderTask represents an asynchronous computation that yields a value of type A
from a context of type E
and never fails .
ReaderTaskEither <E , L , R >
ReaderTaskEither<E, L, R>
represents an asynchronous computation (Task
) that
either yields a value of type R
or fails yielding an error of type L
(Either
),
that allows to read values from a dependency/context E
(Reader
).
Right <L , R >
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.
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 >
Alt3 <KT , P1 , P2 , P3 >
Applicative <G , A >
Applicative2 <G , A , B >
Applicative3 <G , A , B , C >
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 >
Functor3 <G , A , B , C >
Group <T >
A group is a monoid where each element has an inverse .
Monad <KT , A >
Monad2 <KT , A , B >
Monad3 <KT , P1 , P2 , P3 >
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
CurryExtension2
on Output Function(Input1 , Input2 )
Extract first parameter from this function to allow curring.
CurryExtension3
on Output Function(Input1 , Input2 , Input3 )
CurryExtension4
on Output Function(Input1 , Input2 , Input3 , Input4 )
CurryExtension5
on Output Function(Input1 , Input2 , Input3 , Input4 , Input5 )
FpdartOnDateTime
on DateTime
fpdart
extension methods on DateTime
FpdartOnIterable
on Iterable <T >
Get the first element of the Iterable .
If the Iterable is empty, return None .
Functional programming functions on a mutable dart Iterable using fpdart
.
FpdartOnIterableOfIterable
on Iterable <Iterable <T > >
Functional programming functions on Iterable<Iterable<T>>
using fpdart
.
FpdartOnList
on List <T >
Functional programming functions on a mutable dart Iterable using fpdart
.
FpdartOnMap
on Map <K , V >
Functional programming functions on a mutable dart Map using fpdart
.
FpdartOnOption
on Option <T >
FpdartOnOptionMap
on Option <Map <K , dynamic > >
FpdartOnPredicate
on bool Function()
FpdartOnPredicate1
on bool Function(P )
FpdartOnString
on String
Functional programming functions on dart String using fpdart
.
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 > >
FpdartSequenceIterableState
on Iterable <State <S , A > >
Convert a List<State<S, A>>
to a single State<S, List<A>>
.
FpdartSequenceIterableTask
on Iterable <Task <T > >
FpdartSequenceIterableTaskEither
on Iterable <TaskEither <E , T > >
FpdartSequenceIterableTaskOption
on Iterable <TaskOption <T > >
FpdartTraversableIterable
on Iterable <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
dateNow
→ IO <DateTime >
Constructs a DateTime instance with current date and time in the local time zone.
no setter
ioRefEq
→ Eq <IORef <Object ? > >
Eq instance to compare IORef s using pointer equality
final
now
→ IO <int >
The number of milliseconds since the "Unix epoch" 1970-01-01T00:00:00Z (UTC).
no setter
random
→ IO <double >
Generates a non-negative random floating point
value uniformly distributed in the range from 0.0, inclusive , to 1.0, exclusive .
no setter
randomBool
→ IO <bool >
Generates a random boolean value.
no setter
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.
dualEndoMonoid <A > ()
→ Monoid <Endo <A > >
endoMonoid <A > ()
→ Monoid <Endo <A > >
identity <T > (T a )
→ T
Returns the given a
.
identityFuture <T > (T a )
→ Future <T >
Returns the given a
, wrapped in Future.value
.
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 .
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.
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.
right <L , R > (R r )
→ Either <L , R >
Return a Right(r)
.
some <T > (T t )
→ Option <T >
Return a Some(t)
.
toBoolEither <L > (String str , L onLeft () )
→ Either <L , bool >
Convert this String to bool , returns the result of onLeft
for invalid inputs.
toBoolOption (String str )
→ Option <bool >
Convert this String to bool , returns None for invalid inputs.
toDoubleEither <L > (L onLeft () )
→ Either <L , double > Function(String )
Convert this String to double , returns the result of onLeft
for invalid inputs.
toDoubleOption (String str )
→ Option <double >
Convert this String to double , returns None for invalid inputs.
toIntEither <L > (L onLeft () )
→ Either <L , int > Function(String )
Convert this String to int , returns the result of onLeft
for invalid inputs.
toIntOption (String str )
→ Option <int >
Convert this String to int , returns None for invalid inputs.
toNumEither <L > (L onLeft () )
→ Either <L , num > Function(String )
Convert this String to num , returns the result of onLeft
for invalid inputs.
toNumOption (String str )
→ Option <num >
Convert this String to num , returns None for invalid inputs.
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 > )
DoAdapterReaderTask <E >
= Future <A > Function<A >(ReaderTask <E , A > )
DoAdapterReaderTaskEither <E , L >
= Future <A > Function<A >(ReaderTaskEither <E , L , 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 $ )
DoFunctionReaderTask <E , A >
= Future <A > Function(DoAdapterReaderTask <E > $ )
DoFunctionReaderTaskEither <E , L , A >
= Future <A > Function(DoAdapterReaderTaskEither <E , L > $ )
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 )
Separated <KT , A , B >
= (HKT <KT , A > , HKT <KT , B > )