UNPKG

@typed/fp

Version:

Data Structures and Resources for fp-ts

75 lines 2.15 kB
import * as O from 'fp-ts/Option'; import * as RA from 'fp-ts/ReadonlyArray'; import * as E from './Env'; import { flow, pipe } from './function'; /** * @since 0.11.0 * @category Combinator */ export const append = (value) => (ra) => ra.update(flow(RA.append(value), E.of)); /** * @since 0.12.0 * @category Combinator */ export const concat = (end) => (ra) => ra.update(flow(RA.concat(end), E.of)); /** * @since 0.14.0 * @category Combinator */ export const deleteAt = (index) => (ra) => ra.update((list) => pipe(list, RA.deleteAt(index), O.getOrElse(() => list), E.of)); /** * @since 0.11.0 * @category Combinator */ export const filter = (p) => (ra) => ra.update(flow(RA.filter(p), E.of)); /** * @since 0.11.0 * @category Combinator */ export const insertAt = (index, value) => (ra) => ra.update((list) => pipe(list, RA.insertAt(index, value), O.getOrElse(() => list), E.of)); /** * @since 0.11.0 * @category Combinator */ export const modifyAt = (index, f) => (ra) => ra.update((list) => pipe(list, RA.modifyAt(index, f), O.getOrElse(() => list), E.of)); /** * @since 0.11.0 * @category Combinator */ export const prepend = (value) => (ra) => ra.update(flow(RA.prepend(value), E.of)); /** * @since 0.11.0 * @category Combinator */ export const reverse = (ra) => ra.update(flow(RA.reverse, E.of)); /** * @since 0.11.0 * @category Combinator */ export const rotate = (n) => (ra) => ra.update(flow(RA.rotate(n), E.of)); /** * @since 0.11.0 * @category Combinator */ export const sort = (O) => (ra) => ra.update(flow(RA.sort(O), E.of)); /** * @since 0.11.0 * @category Combinator */ export const sortBy = (O) => (ra) => ra.update(flow(RA.sortBy(O), E.of)); /** * @since 0.11.0 * @category Combinator */ export const uniq = (Eq) => (ra) => ra.update(flow(RA.uniq(Eq), E.of)); /** * @since 0.11.0 * @category Combinator */ export const updateAt = (index, a) => (ra) => ra.update((list) => pipe(list, RA.updateAt(index, a), O.getOrElse(() => list), E.of)); /** * @since 0.11.0 * @category Combinator */ export const endoMap = (f) => (ra) => ra.update(flow(RA.map(f), E.of)); //# sourceMappingURL=RefArray.js.map