import { $type, Eval, HKT, Kind, PrimitiveType, TyK, TyVar } from '@fp4ts/core'; import { Eq, Monoid, Ord } from '@fp4ts/cats-kernel'; import { Applicative } from '../../applicative'; import { Foldable } from '../../foldable'; import { EqK } from '../../eq-k'; import { Functor } from '../../functor'; import { FunctorFilter } from '../../functor-filter'; import { MonoidK } from '../../monoid-k'; import { SemigroupK } from '../../semigroup-k'; import { Defer } from '../../defer'; import { Alternative } from '../../alternative'; import { Align } from '../../align'; import { MonadDefer } from '../../monad-defer'; import { TraversableFilter } from '../../traversable-filter'; import { Option } from '../option'; import { Ior } from '../ior'; import { List } from './list'; import { Vector } from './vector'; import { View } from './view'; /** * `LazyList` is implementation of fully lazy linked list. * * Equivalent to: * * ```typescript * type LazyList = Eval]>> * ``` */ export type LazyList = _LazyList; export declare const LazyList: LazyListObj; interface LazyListObj { empty: LazyList; singleton(x: A): LazyList; consEval(x: A, exs: Eval>): LazyList; defer(thunk: () => LazyList): LazyList; unfoldRight(z: B, f: (b: B) => Option<[A, B]>): LazyList; range(from: number, until?: number, step?: number): LazyList; iterate(a: A, f: (a: A) => A): LazyList; (...xs: A[]): LazyList; fromArray(xs: A[]): LazyList; fromList(xs: List): LazyList; fromVector(xs: Vector): LazyList; fromView(xs: View): LazyList; fromIterator(xs: Iterator): LazyList; fromFoldable(F: Foldable): (fa: Kind) => LazyList; EqK: EqK; Defer: Defer; Align: Align; SemigroupK: SemigroupK; MonoidK: MonoidK; Alternative: Alternative; Functor: Functor; FunctorFilter: FunctorFilter; Applicative: Applicative; Monad: MonadDefer; Foldable: Foldable; TraversableFilter: TraversableFilter; } export declare class _LazyList { private _source; static defer: (thunk: () => LazyList) => LazyList; static consEval: (x: A_1, exs: Eval>) => LazyList; constructor(_source: Eval>); private _forcedSource?; private get source(); private get forceSource(); get isEmpty(): boolean; get nonEmpty(): boolean; get head(): A; get headOption(): Option; get tail(): LazyList; get last(): A; get lastOption(): Option; get init(): LazyList; get size(): number; get uncons(): Option<[A, LazyList]>; get view(): View; get toArray(): A[]; get toList(): List; get toVector(): Vector; get iterator(): Iterator; get reverse(): LazyList; [Symbol.iterator](): Iterator; prepend(this: LazyList, x: B): LazyList; cons(this: LazyList, x: B): LazyList; '+::'(this: LazyList, x: B): LazyList; append(this: LazyList, x: B): LazyList; snoc(this: LazyList, x: B): LazyList; '::+'(this: LazyList, x: B): LazyList; concat(this: LazyList, that: LazyList): LazyList; '+++'(this: LazyList, that: LazyList): LazyList; concatEval(this: LazyList, that: Eval>): LazyList; all(p: (a: A) => boolean): boolean; any(p: (a: A) => boolean): boolean; count(p: (a: A) => boolean): number; take(n: number): LazyList; takeWhile(p: (a: A) => a is B): LazyList; takeWhile(p: (a: A) => boolean): LazyList; drop(n: number): LazyList; dropWhile(p: (a: A) => boolean): LazyList; slice(from: number, until: number): LazyList; splitAt(n: number): [LazyList, LazyList]; filter(f: (a: A) => a is B): LazyList; filter(f: (a: A) => boolean): LazyList; filterNot(f: (a: A) => boolean): LazyList; collect(f: (a: A) => Option): LazyList; map(f: (a: A) => B): LazyList; map2(that: LazyList, f: (a: A, b: B) => C): LazyList; map2Eval(that: Eval>, f: (a: A, b: B) => C): Eval>; flatMap(f: (a: A) => LazyList): LazyList; zip(that: LazyList): LazyList<[A, B]>; zipWith(that: LazyList, f: (a: A, b: B) => C): LazyList; align(this: LazyList, that: LazyList): LazyList>; zipAllWith(this: LazyList, that: LazyList, defaultA: () => A, defaultB: () => B, f: (a: A, b: B) => C): LazyList; get zipWithIndex(): LazyList<[A, number]>; foldMap(M: Monoid): (f: (a: A) => M) => M; foldMapLeft(M: Monoid): (f: (a: A) => M) => M; foldMapK(F: MonoidK): (f: (a: A) => Kind) => Kind; foldLeft(z: B, f: (b: B, a: A) => B): B; foldRight(ez: Eval, f: (a: A, eb: Eval) => Eval): Eval; scanLeft(z: B, f: (b: B, a: A) => B): LazyList; scanRight(ez: Eval, f: (a: A, eb: Eval) => Eval): LazyList; traverse(G: Applicative): (f: (a: A) => Kind) => Kind]>; private traverseImpl; traverseFilter(G: Applicative): (f: (a: A) => Kind]>) => Kind]>; private traverseFilterImpl; distinct(this: LazyList, E: Eq): LazyList; distinct(this: LazyList): LazyList; distinctBy(cmp: (x: A, y: A) => boolean): LazyList; sort(this: LazyList, O?: Ord): LazyList; equals(this: LazyList, that: LazyList, E: Eq): boolean; toString(): string; } declare abstract class Source { abstract readonly head: A; abstract readonly tail: Eval>; abstract readonly forceTail: Source; abstract take(n: number): Source; abstract takeWhile(p: (a: A) => boolean): Source; abstract drop(n: number): Source; abstract dropWhile(p: (a: A) => boolean): Source; abstract filter(f: (a: A) => a is B): Source; abstract filter(f: (a: A) => boolean): Source; abstract collect(f: (a: A) => Option): Source; abstract concat(this: Source, that: Eval>): Eval>; abstract map(f: (a: A) => B): Source; abstract flatMap(f: (a: A) => Eval>): Eval>; abstract foldRight(ez: Eval, f: (a: A, eb: Eval) => Eval): Eval; abstract scanLeft(z: B, f: (b: B, a: A) => B): Source; abstract scanRight(ez: Eval, f: (a: A, b: Eval) => Eval): Eval>; abstract zipWith(that: Source, f: (a: A, b: B) => C): Source; abstract zipAllWith(this: Source, that: Source, defaultA: () => A, defaultB: () => B, f: (a: A, b: B) => C): Source; abstract distinctBy(cmp: (x: A, y: A) => boolean): Source; } declare class Cons extends Source { readonly head: A; private _tail; constructor(head: A, _tail: Eval>); private _forcedTail?; get tail(): Eval>; get forceTail(): Source; take(n: number): Source; takeWhile(p: (a: A) => boolean): Source; drop(n: number): Source; dropWhile(p: (a: A) => boolean): Source; filter(f: (a: A) => a is B): Source; filter(f: (a: A) => boolean): Source; collect(f: (a: A) => Option): Source; map(f: (a: A) => B): Source; concat(this: Cons, that: Eval>): Eval>; flatMap(f: (a: A) => Eval>): Eval>; zipWith(that: Source, f: (a: A, b: B) => C): Source; zipAllWith(this: Source, that: Source, defaultA: () => A, defaultB: () => B, f: (a: A, b: B) => C): Source; foldRight(ez: Eval, f: (a: A, eb: Eval) => Eval): Eval; scanLeft(z: B, f: (b: B, a: A) => B): Source; scanRight(ez: Eval, f: (a: A, b: Eval) => Eval): Eval>; distinctBy(cmp: (x: A, y: A) => boolean): Source; } export interface _LazyList extends HKT { } /** * @category Type Constructor * @category Collection */ export interface LazyListF extends TyK<[unknown]> { [$type]: LazyList>; } export {}; //# sourceMappingURL=lazy-list.d.ts.map