Skip to main content Link Search Menu Expand Document (external link)

Traversable overview

Added in v0.24.0


Table of contents


type class

Traversable (interface)

Signature

export interface Traversable<T extends TypeLambda> extends TypeClass<T> {
  readonly traverse: <F extends TypeLambda>(
    F: Applicative<F>
  ) => {
    <A, R, O, E, B>(
      f: (a: A) => Kind<F, R, O, E, B>
    ): <TR, TO, TE>(self: Kind<T, TR, TO, TE, A>) => Kind<F, R, O, E, Kind<T, TR, TO, TE, B>>
    <TR, TO, TE, A, R, O, E, B>(
      self: Kind<T, TR, TO, TE, A>,
      f: (a: A) => Kind<F, R, O, E, B>
    ): Kind<F, R, O, E, Kind<T, TR, TO, TE, B>>
  }
}

Added in v0.24.0

utils

sequence

Returns a default sequence implementation.

Signature

export declare const sequence: <T extends TypeLambda>(
  T: Traversable<T>
) => <F extends TypeLambda>(
  F: Applicative<F>
) => <TR, TO, TE, R, O, E, A>(
  self: Kind<T, TR, TO, TE, Kind<F, R, O, E, A>>
) => Kind<F, R, O, E, Kind<T, TR, TO, TE, A>>

Added in v0.24.0

traverseComposition

Returns a default binary traverse composition.

Signature

export declare const traverseComposition: <T extends TypeLambda, G extends TypeLambda>(
  T: Traversable<T>,
  G: Traversable<G>
) => <F extends TypeLambda>(
  F: Applicative<F>
) => <TR, TO, TE, GR, GO, GE, A, R, O, E, B>(
  self: Kind<T, TR, TO, TE, Kind<G, GR, GO, GE, A>>,
  f: (a: A) => Kind<F, R, O, E, B>
) => Kind<F, R, O, E, Kind<T, TR, TO, TE, Kind<G, GR, GO, GE, B>>>

Added in v0.24.0

traverseTap

Given a function which returns a F effect, thread this effect through the running of this function on all the values in T, returning an T<A> in a F context, ignoring the values returned by the provided function.

Signature

export declare const traverseTap: <T extends TypeLambda>(
  T: Traversable<T>
) => <F extends TypeLambda>(
  F: Applicative<F>
) => {
  <A, R, O, E, B>(
    f: (a: A) => Kind<F, R, O, E, B>
  ): <TR, TO, TE>(self: Kind<T, TR, TO, TE, A>) => Kind<F, R, O, E, Kind<T, TR, TO, TE, A>>
  <TR, TO, TE, A, R, O, E, B>(
    self: Kind<T, TR, TO, TE, A>,
    f: (a: A) => Kind<F, R, O, E, B>
  ): Kind<F, R, O, E, Kind<T, TR, TO, TE, A>>
}

Added in v0.24.0