Documentation
¶
Index ¶
- Variables
- func Ap[B, A any](ma IO[A]) func(IO[func(A) B]) IO[B]
- func ApFirst[A, B any](second IO[B]) func(IO[A]) IO[A]
- func ApSecond[A, B any](second IO[B]) func(IO[A]) IO[B]
- func ApplicativeMonoid[A any](m M.Monoid[A]) M.Monoid[IO[A]]
- func ApplySemigroup[A any](s S.Semigroup[A]) S.Semigroup[IO[A]]
- func Chain[A, B any](f func(A) IO[B]) func(IO[A]) IO[B]
- func ChainFirst[A, B any](f func(A) IO[B]) func(IO[A]) IO[A]
- func ChainTo[A, B any](fb IO[B]) func(IO[A]) IO[B]
- func Eq[A any](e EQ.Eq[A]) EQ.Eq[IO[A]]
- func Logf[A any](prefix string) func(A) IO[any]
- func Logger[A any](loggers ...*log.Logger) func(string) func(A) IO[any]
- func Map[A, B any](f func(A) B) func(fa IO[A]) IO[B]
- func MapTo[A, B any](b B) func(IO[A]) IO[B]
- func TraverseArray[A, B any](f func(A) IO[B]) func([]A) IO[[]B]
- func TraverseRecord[K comparable, A, B any](f func(A) IO[B]) func(map[K]A) IO[map[K]B]
- type IO
- func Defer[A any](gen func() IO[A]) IO[A]
- func Flatten[A any](mma IO[IO[A]]) IO[A]
- func FromIO[A any](a IO[A]) IO[A]
- func FromImpure(f func()) IO[any]
- func MakeIO[A any](f func() A) IO[A]
- func Memoize[A any](ma IO[A]) IO[A]
- func MonadAp[B, A any](mab IO[func(A) B], ma IO[A]) IO[B]
- func MonadApFirst[A, B any](first IO[A], second IO[B]) IO[A]
- func MonadApSecond[A, B any](first IO[A], second IO[B]) IO[B]
- func MonadChain[A, B any](fa IO[A], f func(A) IO[B]) IO[B]
- func MonadChainFirst[A, B any](fa IO[A], f func(A) IO[B]) IO[A]
- func MonadChainTo[A, B any](fa IO[A], fb IO[B]) IO[B]
- func MonadMap[A, B any](fa IO[A], f func(A) B) IO[B]
- func MonadMapTo[A, B any](fa IO[A], b B) IO[B]
- func MonadOf[A any](a A) IO[A]
- func MonadTraverseArray[A, B any](tas []A, f func(A) IO[B]) IO[[]B]
- func MonadTraverseRecord[K comparable, A, B any](tas map[K]A, f func(A) IO[B]) IO[map[K]B]
- func Of[A any](a A) IO[A]
- func Retrying[A any](policy R.RetryPolicy, action func(R.RetryStatus) IO[A], check func(A) bool) IO[A]
- func SequenceArray[A any](tas []IO[A]) IO[[]A]
- func SequenceRecord[K comparable, A any](tas map[K]IO[A]) IO[map[K]A]
- func SequenceT1[A any](a IO[A]) IO[T.Tuple1[A]]
- func SequenceT2[A, B any](a IO[A], b IO[B]) IO[T.Tuple2[A, B]]
- func SequenceT3[A, B, C any](a IO[A], b IO[B], c IO[C]) IO[T.Tuple3[A, B, C]]
- func SequenceT4[A, B, C, D any](a IO[A], b IO[B], c IO[C], d IO[D]) IO[T.Tuple4[A, B, C, D]]
Constants ¶
This section is empty.
Variables ¶
Now returns the current timestamp
Functions ¶
func Chain ¶
Chain composes computations in sequence, using the return value of one computation to determine the next computation.
func ChainFirst ¶
ChainFirst composes computations in sequence, using the return value of one computation to determine the next computation and keeping only the result of the first.
func ChainTo ¶
ChainTo composes computations in sequence, ignoring the return value of the first computation
func Logf ¶
Logf constructs a logger function that can be used with ChainXXXIOK the string prefix contains the format string for the log value
func TraverseArray ¶
TraverseArray applies a function returning an IO to all elements in an array and the transforms this into an IO of that array
func TraverseRecord ¶
func TraverseRecord[K comparable, A, B any](f func(A) IO[B]) func(map[K]A) IO[map[K]B]
TraverseArray applies a function returning an IO to all elements in a record and the transforms this into an IO of that record
Types ¶
type IO ¶
type IO[A any] func() A
IO represents a synchronous computation that cannot fail refer to [https://andywhite.xyz/posts/2021-01-27-rte-foundations/#ioltagt] for more details
func FromImpure ¶
FromImpure converts a side effect without a return value into a side effect that returns any
func MonadApFirst ¶
MonadApFirst combines two effectful actions, keeping only the result of the first.
func MonadApSecond ¶
MonadApSecond combines two effectful actions, keeping only the result of the second.
func MonadChain ¶
MonadChain composes computations in sequence, using the return value of one computation to determine the next computation.
func MonadChainFirst ¶
MonadChainFirst composes computations in sequence, using the return value of one computation to determine the next computation and keeping only the result of the first.
func MonadChainTo ¶
MonadChainTo composes computations in sequence, ignoring the return value of the first computation
func MonadMapTo ¶
func MonadTraverseArray ¶
func MonadTraverseRecord ¶
func MonadTraverseRecord[K comparable, A, B any](tas map[K]A, f func(A) IO[B]) IO[map[K]B]
func Retrying ¶
func Retrying[A any]( policy R.RetryPolicy, action func(R.RetryStatus) IO[A], check func(A) bool, ) IO[A]
Retrying will retry the actions according to the check policy
policy - refers to the retry policy action - converts a status into an operation to be executed check - checks if the result of the action needs to be retried
func SequenceArray ¶
func SequenceRecord ¶
func SequenceRecord[K comparable, A any](tas map[K]IO[A]) IO[map[K]A]