since import { Eq } from 'fp-ts/lib/Eq' ; import * as O from 'fp-ts/lib/Option' ; import { pipe } from 'fp-ts/lib/pipeable' ; import * as RM from 'fp-ts/lib/ReadonlyMap' ; import { ReadonlyRecord } from 'fp-ts/lib/ReadonlyRecord' ; import * as RS from 'fp-ts/lib/ReadonlySet' ; import * as _ from './internal' ; import { Iso } from './Iso' ; import { Lens } from './Lens' ; import Option = O . Option ; category since export interface At < S , I , A > { readonly at : ( i : I ) => Lens < S , A > ; } category since export const at = _ . at ; category since export const fromIso = < T , S > ( iso ) => < I , A > ( sia ) : At < T , I , A > => at ( ( i ) => pipe ( iso , _ . isoAsLens , _ . lensComposeLens ( sia . at ( i ) ) ) ) ; category since export const atReadonlyRecord = _ . atReadonlyRecord ; category since export const atReadonlyMap = < K > ( E ) : ( < A = never > ( ) => At < ReadonlyMap < K , A > , K , Option < A > > ) => { const lookupE = RM . lookup ( E ) ; const deleteAtE = RM . deleteAt ( E ) ; const insertAtE = RM . insertAt ( E ) ; return ( ) => at ( ( key ) => _ . lens ( ( s ) => lookupE ( key , s ) , O . fold ( ( ) => deleteAtE ( key ) , ( a ) => insertAtE ( key , a ) ) ) ) ; } ; category since export const atReadonlySet = < A > ( E ) : At < ReadonlySet < A > , A , boolean > => { const elemE = RS . elem ( E ) ; const insertE = RS . insert ( E ) ; const removeE = RS . remove ( E ) ; return at ( ( a ) => { const insert = insertE ( a ) ; const remove = removeE ( a ) ; return _ . lens ( ( s ) => elemE ( a , s ) , ( b ) => ( s ) => ( b ? insert ( s ) : remove ( s ) ) ) ; } ) ; } ; category since deprecated export const atRecord = _ . atReadonlyRecord ;