A structure which can be traversed to the structure of same shape by performing Applicative action.

All instances of the traversable functor tra must satisfy the following laws:

  • Naturality: For all t, f and x; t(tra.traverse(app1)(f)(x)) equals to tra.traverse(app2)((item) => t(f(item)))(x), where app1 and app2 are appropriate applicative functors about f and t respectively,
  • Identity: For all x; tra.traverse(Identity.applicative)((a) => a)(x) equals to x,
  • Composition: For all f, g, x and composed applicative functor app for Compose<F, G, _>; tra.traverse(app)((item) => app.map(g)(f(item)))(x) equals to app.map(tra.traverse(app)(g))(tra.traverse(app)(f)(x)).

Type Parameters

  • T

Hierarchy

Properties

Properties

foldR: (<A, B>(folder) => ((init) => ((data) => B)))

Type declaration

    • <A, B>(folder): ((init) => ((data) => B))
    • Folds the data structure with folder function by right associativity.

      Type Parameters

      • A

      • B

      Parameters

      • folder: ((next) => ((acc) => B))

        The function which takes the next and accumulating value and returns the calculated accumulation.

          • (next): ((acc) => B)
          • Parameters

            • next: A

            Returns ((acc) => B)

              • (acc): B
              • Parameters

                • acc: B

                Returns B

      Returns ((init) => ((data) => B))

      The accumulated result value.

        • (init): ((data) => B)
        • Parameters

          • init: B

          Returns ((data) => B)

map: (<T, U>(fn) => ((t) => Instance<Apply1<T, U>>))

Type declaration

traverse: (<F>(app) => (<A, B>(visitor) => ((data) => Get1<F, Get1<T, B>>)))

Type declaration

    • <F>(app): (<A, B>(visitor) => ((data) => Get1<F, Get1<T, B>>))
    • Maps each item of the structure data to an action, and evaluates them from left to right, then collects the result.

      Type Parameters

      • F

      Parameters

      Returns (<A, B>(visitor) => ((data) => Get1<F, Get1<T, B>>))

      The collected result of actions.

        • <A, B>(visitor): ((data) => Get1<F, Get1<T, B>>)
        • Type Parameters

          • A

          • B

          Parameters

          • visitor: ((a) => Get1<F, B>)
              • (a): Get1<F, B>
              • Parameters

                • a: A

                Returns Get1<F, B>

          Returns ((data) => Get1<F, Get1<T, B>>)

Generated using TypeDoc