IO<A> class final

IO<A> represents a non-deterministic synchronous computation that can cause side effects, yields a value of type A and never fails.

If you want to represent a synchronous computation that may fail, see IOEither.

Inheritance
Mixed in types

Constructors

IO(A _run())
Build an instance of IO from A Function().
const
IO.Do(DoFunctionIO<A> f)
Initialize a Do Notation chain.
factory
IO.flatten(IO<IO<A>> io)
Flat a IO contained inside another IO to be a single IO.
factory
IO.of(A a)
Build a IO that returns a.
factory

Properties

hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

andThen<B>(covariant IO<B> then()) IO<B>
Chain the result of then to this IO.
override
ap<B>(covariant IO<B Function(A a)> a) IO<B>
Apply the function contained inside a to change the value of type A to a value of type B.
override
call<B>(covariant IO<B> chain) IO<B>
Chain multiple IO functions.
override
chainFirst<B>(covariant Monad<_IOHKT, B> chain(A a)) HKT<_IOHKT, A>
inherited
flatMap<B>(covariant IO<B> f(A a)) IO<B>
Used to chain multiple functions that return a IO.
override
flatMapTask<B>(Task<B> f(A a)) Task<B>
Chain a Task with an IO.
map<B>(B f(A a)) IO<B>
Change the value of type A to a value of type B using function f.
override
map2<C, D>(covariant IO<C> mc, D f(A a, C c)) IO<D>
Change type of this IO based on its value of type A and the value of type C of another IO.
override
map3<C, D, E>(covariant IO<C> mc, covariant IO<D> md, E f(A a, C c, D d)) IO<E>
Change type of this IO based on its value of type A, the value of type C of a second IO, and the value of type D of a third IO.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pure<B>(B b) IO<B>
Return an IO that returns the value b.
override
run() → A
Execute the IO function.
toIOEither<L>() IOEither<L, A>
Convert this IO to a IOEither.
toIOOption() IOOption<A>
Convert this IO to a IOOption.
toString() String
A string representation of this object.
inherited
toTask() Task<A>
Lift this IO to a Task.
toTaskEither<L>() TaskEither<L, A>
Convert this IO to a TaskEither.
toTaskOption() TaskOption<A>
Convert this IO to a TaskOption.

Operators

operator ==(Object other) bool
The equality operator.
override

Static Methods

sequenceList<A>(List<IO<A>> list) IO<List<A>>
Convert a List<IO<A>> to a single IO<List<A>>.
traverseList<A, B>(List<A> list, IO<B> f(A a)) IO<List<B>>
Map each element in the list to an IO using the function f, and collect the result in an IO<List<B>>.
traverseListWithIndex<A, B>(List<A> list, IO<B> f(A a, int i)) IO<List<B>>
Map each element in the list to an IO using the function f, and collect the result in an IO<List<B>>.