78 lines
2.1 KiB
TypeScript
78 lines
2.1 KiB
TypeScript
|
/**
|
||
|
* **This module is experimental**
|
||
|
*
|
||
|
* Experimental features are published in order to get early feedback from the community.
|
||
|
*
|
||
|
* A feature tagged as _Experimental_ is in a high state of flux, you're at risk of it changing without notice.
|
||
|
*
|
||
|
* @since 2.3.0
|
||
|
*/
|
||
|
import * as O from 'fp-ts/es6/Option'
|
||
|
import { At } from './At'
|
||
|
import { Iso } from './Iso'
|
||
|
import { Optional } from './Optional'
|
||
|
import { Eq } from 'fp-ts/es6/Eq'
|
||
|
import Option = O.Option
|
||
|
import { ReadonlyRecord } from 'fp-ts/es6/ReadonlyRecord'
|
||
|
import { ReadonlyNonEmptyArray } from 'fp-ts/es6/ReadonlyNonEmptyArray'
|
||
|
/**
|
||
|
* @category model
|
||
|
* @since 2.3.0
|
||
|
*/
|
||
|
export interface Index<S, I, A> {
|
||
|
readonly index: (i: I) => Optional<S, A>
|
||
|
}
|
||
|
/**
|
||
|
* @category constructors
|
||
|
* @since 2.3.8
|
||
|
*/
|
||
|
export declare const index: <S, I, A>(index: Index<S, I, A>['index']) => Index<S, I, A>
|
||
|
/**
|
||
|
* @category constructors
|
||
|
* @since 2.3.0
|
||
|
*/
|
||
|
export declare const fromAt: <T, J, B>(at: At<T, J, O.Option<B>>) => Index<T, J, B>
|
||
|
/**
|
||
|
* Lift an instance of `Index` using an `Iso`.
|
||
|
*
|
||
|
* @category constructors
|
||
|
* @since 2.3.0
|
||
|
*/
|
||
|
export declare const fromIso: <T, S>(iso: Iso<T, S>) => <I, A>(sia: Index<S, I, A>) => Index<T, I, A>
|
||
|
/**
|
||
|
* @category constructors
|
||
|
* @since 2.3.7
|
||
|
*/
|
||
|
export declare const indexReadonlyArray: <A = never>() => Index<ReadonlyArray<A>, number, A>
|
||
|
/**
|
||
|
* @category constructors
|
||
|
* @since 2.3.8
|
||
|
*/
|
||
|
export declare const indexReadonlyNonEmptyArray: <A = never>() => Index<ReadonlyNonEmptyArray<A>, number, A>
|
||
|
/**
|
||
|
* @category constructors
|
||
|
* @since 2.3.7
|
||
|
*/
|
||
|
export declare const indexReadonlyRecord: <A = never>() => Index<ReadonlyRecord<string, A>, string, A>
|
||
|
/**
|
||
|
* @category constructors
|
||
|
* @since 2.3.7
|
||
|
*/
|
||
|
export declare const indexReadonlyMap: <K>(E: Eq<K>) => <A = never>() => Index<ReadonlyMap<K, A>, K, A>
|
||
|
/**
|
||
|
* Use `indexReadonlyArray` instead.
|
||
|
*
|
||
|
* @category constructors
|
||
|
* @since 2.3.2
|
||
|
* @deprecated
|
||
|
*/
|
||
|
export declare const indexArray: <A = never>() => Index<ReadonlyArray<A>, number, A>
|
||
|
/**
|
||
|
* Use `indexReadonlyRecord` instead.
|
||
|
*
|
||
|
* @category constructors
|
||
|
* @since 2.3.2
|
||
|
* @deprecated
|
||
|
*/
|
||
|
export declare const indexRecord: <A = never>() => Index<ReadonlyRecord<string, A>, string, A>
|