import type { Kind } from '../../kinds/index.js'; import type { Applicative } from '../applicative'; import type { Functor } from '../functor'; import type { TypeSkell } from '../../typeskell/index.js'; import { Foldable } from '../foldable'; export declare namespace Traversable { type $traverse = TypeSkell<'(a -> F b ..x) -> T a ..y -> F (T b ..y) ..x', { F: F; T: T; }>; type $sequence = TypeSkell<'T (F a ..x) ..y -> F (T a ..y) ..x', { F: F; T: T; }>; } /** * Traversable is a typeclass that provides a way to traverse a data structure with an effect. * * Laws: * - Naturality: t . traverse f = traverse (t . f) * - Identity: traverse Identity = Identity * - Composition: traverse (Compose . fmap g . f) = Compose . fmap (traverse g) . traverse f */ export interface Traversable extends Functor, Foldable { /** * traverse :: `Applicative F -> (a -> F b) -> T a -> F (T b)` * * @param F `Applicative F` * @returns `(a -> F b) -> T a -> F (T b)` */ traverse: (F: Applicative) => Traversable.$traverse; } /** * sequence :: `Traversable T -> Applicative F -> T (F a) -> F (T a)` * * @param traversable `Traversable T` * @returns `Applicative F -> T (F a) -> F (T a)` */ export declare const sequence: (traversable: Traversable) => (F: Applicative) => Traversable.$sequence;