/** * @since 2.0.0 */ import { Either } from './Either.js'; import { Filterable, Filterable1, Filterable2, Filterable2C, Filterable3, Filterable3C, Filterable4 } from './Filterable.js'; import { FunctorWithIndex, FunctorWithIndex1, FunctorWithIndex2, FunctorWithIndex2C, FunctorWithIndex3, FunctorWithIndex3C, FunctorWithIndex4 } from './FunctorWithIndex.js'; import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT.js'; import { Option } from './Option.js'; import { Separated } from './Separated.js'; /** * @since 2.0.0 */ export type RefinementWithIndex = (i: I, a: A) => a is B; /** * @since 2.0.0 */ export type PredicateWithIndex = (i: I, a: A) => boolean; /** * @since 2.0.0 */ export interface FilterWithIndex { (fa: HKT, refinementWithIndex: RefinementWithIndex): HKT; (fa: HKT, predicateWithIndex: PredicateWithIndex): HKT; } /** * @since 2.0.0 */ export interface PartitionWithIndex { (fa: HKT, refinementWithIndex: RefinementWithIndex): Separated, HKT>; (fa: HKT, predicateWithIndex: PredicateWithIndex): Separated, HKT>; } /** * @category model * @since 2.0.0 */ export interface FilterableWithIndex extends FunctorWithIndex, Filterable { readonly partitionMapWithIndex: (fa: HKT, f: (i: I, a: A) => Either) => Separated, HKT>; readonly partitionWithIndex: PartitionWithIndex; readonly filterMapWithIndex: (fa: HKT, f: (i: I, a: A) => Option) => HKT; readonly filterWithIndex: FilterWithIndex; } /** * @since 2.0.0 */ export interface FilterWithIndex1 { (fa: Kind, refinementWithIndex: RefinementWithIndex): Kind; (fa: Kind, predicateWithIndex: PredicateWithIndex): Kind; } /** * @since 2.0.0 */ export interface PartitionWithIndex1 { (fa: Kind, refinementWithIndex: RefinementWithIndex): Separated, Kind>; (fa: Kind, predicateWithIndex: PredicateWithIndex): Separated, Kind>; } /** * @category model * @since 2.0.0 */ export interface FilterableWithIndex1 extends FunctorWithIndex1, Filterable1 { readonly partitionMapWithIndex: (fa: Kind, f: (i: I, a: A) => Either) => Separated, Kind>; readonly partitionWithIndex: PartitionWithIndex1; readonly filterMapWithIndex: (fa: Kind, f: (i: I, a: A) => Option) => Kind; readonly filterWithIndex: FilterWithIndex1; } /** * @since 2.0.0 */ export interface FilterWithIndex2 { (fa: Kind2, refinementWithIndex: RefinementWithIndex): Kind2; (fa: Kind2, predicateWithIndex: PredicateWithIndex): Kind2; } /** * @since 2.0.0 */ export interface PartitionWithIndex2 { (fa: Kind2, refinementWithIndex: RefinementWithIndex): Separated, Kind2>; (fa: Kind2, predicateWithIndex: PredicateWithIndex): Separated, Kind2>; } /** * @category model * @since 2.0.0 */ export interface FilterableWithIndex2 extends FunctorWithIndex2, Filterable2 { readonly partitionMapWithIndex: (fa: Kind2, f: (i: I, a: A) => Either) => Separated, Kind2>; readonly partitionWithIndex: PartitionWithIndex2; readonly filterMapWithIndex: (fa: Kind2, f: (i: I, a: A) => Option) => Kind2; readonly filterWithIndex: FilterWithIndex2; } /** * @since 2.0.0 */ export interface FilterWithIndex2C { (fa: Kind2, refinementWithIndex: RefinementWithIndex): Kind2; (fa: Kind2, predicateWithIndex: PredicateWithIndex): Kind2; } /** * @since 2.0.0 */ export interface PartitionWithIndex2C { (fa: Kind2, refinementWithIndex: RefinementWithIndex): Separated, Kind2>; (fa: Kind2, predicateWithIndex: PredicateWithIndex): Separated, Kind2>; } /** * @category model * @since 2.0.0 */ export interface FilterableWithIndex2C extends FunctorWithIndex2C, Filterable2C { readonly partitionMapWithIndex: (fa: Kind2, f: (i: I, a: A) => Either) => Separated, Kind2>; readonly partitionWithIndex: PartitionWithIndex2C; readonly filterMapWithIndex: (fa: Kind2, f: (i: I, a: A) => Option) => Kind2; readonly filterWithIndex: FilterWithIndex2C; } /** * @since 2.0.0 */ export interface FilterWithIndex3 { (fa: Kind3, refinementWithIndex: RefinementWithIndex): Kind3; (fa: Kind3, predicateWithIndex: PredicateWithIndex): Kind3; } /** * @since 2.2.0 */ export interface FilterWithIndex3C { (fa: Kind3, refinementWithIndex: RefinementWithIndex): Kind3; (fa: Kind3, predicateWithIndex: PredicateWithIndex): Kind3; } /** * @category model * @since 2.2.0 */ export interface FilterableWithIndex3C extends FunctorWithIndex3C, Filterable3C { readonly partitionMapWithIndex: (fa: Kind3, f: (i: I, a: A) => Either) => Separated, Kind3>; readonly partitionWithIndex: PartitionWithIndex3C; readonly filterMapWithIndex: (fa: Kind3, f: (i: I, a: A) => Option) => Kind3; readonly filterWithIndex: FilterWithIndex3C; } /** * @since 2.0.0 */ export interface PartitionWithIndex3 { (fa: Kind3, refinementWithIndex: RefinementWithIndex): Separated, Kind3>; (fa: Kind3, predicateWithIndex: PredicateWithIndex): Separated, Kind3>; } /** * @since 2.2.0 */ export interface PartitionWithIndex3C { (fa: Kind3, refinementWithIndex: RefinementWithIndex): Separated, Kind3>; (fa: Kind3, predicateWithIndex: PredicateWithIndex): Separated, Kind3>; } /** * @category model * @since 2.0.0 */ export interface FilterableWithIndex3 extends FunctorWithIndex3, Filterable3 { readonly partitionMapWithIndex: (fa: Kind3, f: (i: I, a: A) => Either) => Separated, Kind3>; readonly partitionWithIndex: PartitionWithIndex3; readonly filterMapWithIndex: (fa: Kind3, f: (i: I, a: A) => Option) => Kind3; readonly filterWithIndex: FilterWithIndex3; } /** * @since 2.0.0 */ export interface FilterWithIndex4 { (fa: Kind4, refinementWithIndex: RefinementWithIndex): Kind4; (fa: Kind4, predicateWithIndex: PredicateWithIndex): Kind4; } /** * @since 2.0.0 */ export interface PartitionWithIndex4 { (fa: Kind4, refinementWithIndex: RefinementWithIndex): Separated, Kind4>; (fa: Kind4, predicateWithIndex: PredicateWithIndex): Separated, Kind4>; } /** * @category model * @since 2.0.0 */ export interface FilterableWithIndex4 extends FunctorWithIndex4, Filterable4 { readonly partitionMapWithIndex: (fa: Kind4, f: (i: I, a: A) => Either) => Separated, Kind4>; readonly partitionWithIndex: PartitionWithIndex4; readonly filterMapWithIndex: (fa: Kind4, f: (i: I, a: A) => Option) => Kind4; readonly filterWithIndex: FilterWithIndex4; }