Created
March 23, 2018 11:15
-
-
Save stuf/4ff7938bbaf224b6d8313e691830c2d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export declare type Lens = string | number; | |
export declare type Optic = Lens | Array<Lens>; | |
export type Pred<T> = (x: T) => boolean; | |
export type GetValueFn<T = any, U = T> = (maybeData: T, index: number) => U; | |
export type SetValueFn<T1 = any, T2 = T1, U = T2> = (maybeValue: T1, maybeData: T2, index: number) => U; | |
export type ModifyFn<T = any, U = T> = (maybeData: T, i?: number) => U; | |
export declare interface Semigroup<T> { | |
concat(x: T, y: T): T; | |
} | |
export declare interface Monoid<T> extends Semigroup<T> { | |
empty(): T; | |
} | |
export function modify<T, R>(o: Optic, fn: ModifyFn<T, R>, x: T): R; | |
export function remove<T, R>(o: Optic, x: T): R; | |
export function set<T1, T2, R>(o: Optic, x: T2, v: T1): R; | |
export function get<T, R>(o: Optic, x: T): R; | |
export function compose(...optics: Array<Optic>): Optic; | |
export function when<T>(pred: Pred<T>): Optic; | |
export function seq(...os: Array<Optic>): any; | |
export function lens(getter: GetValueFn, setter: SetValueFn): Lens; | |
export function defaults(v: any): Lens; | |
export function normalize(fn: GetValueFn): Lens; | |
export function required(valueOut: any): Lens; | |
export function rewrite(fn: GetValueFn): Lens; | |
export function concat<T, R>(monoid: Monoid<T>, traversal: any, data: T): R; | |
export function concatAs<T, R>(fn: GetValueFn<T>, monoid: Monoid<T>, traversal: any, data: T): R; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment