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

TraversableFilterable overview

TraversableFilterable represents data structures which can be partitioned with effects in some Applicative functor.

Added in v0.24.0


Table of contents


models

TraversableFilterable (interface)

Signature

export interface TraversableFilterable<T extends TypeLambda> extends TypeClass<T> {
  readonly traversePartitionMap: <F extends TypeLambda>(
    F: Applicative<F>
  ) => {
    <A, R, O, E, B, C>(
      f: (a: A) => Kind<F, R, O, E, Either<C, B>>
    ): <TR, TO, TE>(self: Kind<T, TR, TO, TE, A>) => Kind<F, R, O, E, [Kind<T, TR, TO, TE, B>, Kind<T, TR, TO, TE, C>]>
    <TR, TO, TE, A, R, O, E, B, C>(
      self: Kind<T, TR, TO, TE, A>,
      f: (a: A) => Kind<F, R, O, E, Either<C, B>>
    ): Kind<F, R, O, E, [Kind<T, TR, TO, TE, B>, Kind<T, TR, TO, TE, C>]>
  }

  readonly traverseFilterMap: <F extends TypeLambda>(
    F: Applicative<F>
  ) => {
    <A, R, O, E, B>(
      f: (a: A) => Kind<F, R, O, E, Option<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, Option<B>>
    ): Kind<F, R, O, E, Kind<T, TR, TO, TE, B>>
  }
}

Added in v0.24.0

utils

traverseFilter

Signature

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

Added in v0.24.0

traverseFilterMap

Returns a default binary traverseFilterMap implementation.

Signature

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

Added in v0.24.0

traversePartition

Signature

export declare const traversePartition: <T extends TypeLambda>(
  T: TraversableFilterable<T>
) => <F extends TypeLambda>(
  F: Applicative<F>
) => {
  <B extends A, R, O, E, A = B>(
    predicate: (a: A) => Kind<F, R, O, E, boolean>
  ): <TR, TO, TE>(self: Kind<T, TR, TO, TE, B>) => Kind<F, R, O, E, [Kind<T, TR, TO, TE, B>, Kind<T, TR, TO, TE, B>]>
  <TR, TO, TE, B extends A, R, O, E, A = B>(
    self: Kind<T, TR, TO, TE, B>,
    predicate: (a: A) => Kind<F, R, O, E, boolean>
  ): Kind<F, R, O, E, [Kind<T, TR, TO, TE, B>, Kind<T, TR, TO, TE, B>]>
}

Added in v0.24.0

traversePartitionMap

Returns a default binary traversePartitionMap implementation.

Signature

export declare const traversePartitionMap: <T extends TypeLambda>(
  T: Traversable<T> & Covariant<T> & Filterable<T>
) => <F extends TypeLambda>(
  F: Applicative<F>
) => <TR, TO, TE, A, R, O, E, B, C>(
  self: Kind<T, TR, TO, TE, A>,
  f: (a: A) => Kind<F, R, O, E, Either<C, B>>
) => Kind<F, R, O, E, [Kind<T, TR, TO, TE, B>, Kind<T, TR, TO, TE, C>]>

Added in v0.24.0