/** * @since 2.5.0 */ import { Either } from './Either' import { Eq } from './Eq' import { Magma } from './Magma' import { Monoid } from './Monoid' import { Option } from './Option' import { Ord } from './Ord' import { Predicate } from './Predicate' import { Refinement } from './Refinement' import { Semigroup } from './Semigroup' import { Separated } from './Separated' import { Show } from './Show' /** * @category conversions * @since 2.5.0 */ export declare const fromSet: (s: Set) => ReadonlySet /** * Create a set with one element * * @category constructors * @since 2.5.0 */ export declare const singleton: (a: A) => ReadonlySet /** * Create a `ReadonlySet` from a `ReadonlyArray` * * @category conversions * @since 2.10.0 */ export declare const fromReadonlyArray: (E: Eq) => (as: readonly A[]) => ReadonlySet /** * @category conversions * @since 2.5.0 */ export declare function toSet(s: ReadonlySet): Set /** * Projects a Set through a function * * @since 2.5.0 */ export declare function map(E: Eq): (f: (x: A) => B) => (set: ReadonlySet) => ReadonlySet /** * @since 2.5.0 */ export declare function chain(E: Eq): (f: (x: A) => ReadonlySet) => (set: ReadonlySet) => ReadonlySet /** * @since 2.5.0 */ export declare function filter(refinement: Refinement): (set: ReadonlySet) => ReadonlySet export declare function filter(predicate: Predicate): (set: ReadonlySet) => ReadonlySet export declare function filter(predicate: Predicate): (set: ReadonlySet) => ReadonlySet /** * @since 2.5.0 */ export declare function partition( refinement: Refinement ): (set: ReadonlySet) => Separated, ReadonlySet> export declare function partition( predicate: Predicate ): (set: ReadonlySet) => Separated, ReadonlySet> export declare function partition( predicate: Predicate ): (set: ReadonlySet) => Separated, ReadonlySet> /** * Form the union of two sets * * @since 2.5.0 */ export declare function union(E: Eq): { (that: ReadonlySet): (me: ReadonlySet) => ReadonlySet (me: ReadonlySet, that: ReadonlySet): ReadonlySet } /** * The set of elements which are in both the first and second set * * @since 2.5.0 */ export declare function intersection(E: Eq): { (that: ReadonlySet): (me: ReadonlySet) => ReadonlySet (me: ReadonlySet, that: ReadonlySet): ReadonlySet } /** * @since 2.5.0 */ export declare function partitionMap( EB: Eq, EC: Eq ): (f: (a: A) => Either) => (set: ReadonlySet) => Separated, ReadonlySet> /** * Form the set difference (`x` - `y`) * * @example * import { difference } from 'fp-ts/ReadonlySet' * import * as N from 'fp-ts/number' * import { pipe } from 'fp-ts/function' * * assert.deepStrictEqual(pipe(new Set([1, 2]), difference(N.Eq)(new Set([1, 3]))), new Set([2])) * * @since 2.5.0 */ export declare function difference(E: Eq): { (that: ReadonlySet): (me: ReadonlySet) => ReadonlySet (me: ReadonlySet, that: ReadonlySet): ReadonlySet } /** * @since 2.5.0 */ export declare function reduce(O: Ord): (b: B, f: (b: B, a: A) => B) => (fa: ReadonlySet) => B /** * @since 2.5.0 */ export declare function foldMap(O: Ord, M: Monoid): (f: (a: A) => M) => (fa: ReadonlySet) => M /** * @category folding * @since 2.11.0 */ export declare const reduceRight: (O: Ord) => (b: B, f: (a: A, b: B) => B) => (fa: ReadonlySet) => B /** * Insert a value into a set * * @since 2.5.0 */ export declare function insert(E: Eq): (a: A) => (set: ReadonlySet) => ReadonlySet /** * Delete a value from a set * * @since 2.5.0 */ export declare const remove: (E: Eq) => (a: A) => (set: ReadonlySet) => ReadonlySet /** * Checks an element is a member of a set; * If yes, removes the value from the set * If no, inserts the value to the set * * @since 2.10.0 */ export declare const toggle: (E: Eq) => (a: A) => (set: ReadonlySet) => ReadonlySet /** * @since 2.5.0 */ export declare const compact: (E: Eq) => (fa: ReadonlySet>) => ReadonlySet /** * @since 2.5.0 */ export declare function separate( EE: Eq, EA: Eq ): (fa: ReadonlySet>) => Separated, ReadonlySet> /** * @since 2.5.0 */ export declare function filterMap(E: Eq): (f: (a: A) => Option) => (fa: ReadonlySet) => ReadonlySet /** * @since 2.5.0 */ export declare const empty: ReadonlySet /** * Test whether a `ReadonlySet` is empty. * * @since 2.10.0 */ export declare const isEmpty: (set: ReadonlySet) => boolean /** * Calculate the number of elements in a `ReadonlySet`. * * @since 2.10.0 */ export declare const size: (set: ReadonlySet) => number /** * @since 2.5.0 */ export declare const some: (predicate: Predicate) => (set: ReadonlySet) => boolean /** * @since 2.5.0 */ export declare function every(refinement: Refinement): Refinement, ReadonlySet> export declare function every(predicate: Predicate): Predicate> /** * `true` if and only if every element in the first set is an element of the second set * * @since 2.5.0 */ export declare function isSubset(E: Eq): { (that: ReadonlySet): (me: ReadonlySet) => boolean (me: ReadonlySet, that: ReadonlySet): boolean } /** * Test if a value is a member of a set * * @since 2.5.0 */ export declare function elem(E: Eq): { (a: A): (set: ReadonlySet) => boolean (a: A, set: ReadonlySet): boolean } /** * Get a sorted `ReadonlyArray` of the values contained in a `ReadonlySet`. * * @category conversions * @since 2.5.0 */ export declare const toReadonlyArray: (O: Ord) => (set: ReadonlySet) => readonly A[] /** * @category type lambdas * @since 2.11.0 */ export declare const URI = 'ReadonlySet' /** * @category type lambdas * @since 2.11.0 */ export declare type URI = typeof URI declare module './HKT' { interface URItoKind { readonly [URI]: ReadonlySet } } /** * @category instances * @since 2.5.0 */ export declare function getShow(S: Show): Show> /** * @category instances * @since 2.5.0 */ export declare function getEq(E: Eq): Eq> /** * @category instances * @since 2.11.0 */ export declare const getUnionSemigroup: (E: Eq) => Semigroup> /** * @category instances * @since 2.5.0 */ export declare const getUnionMonoid: (E: Eq) => Monoid> /** * @category instances * @since 2.5.0 */ export declare const getIntersectionSemigroup: (E: Eq) => Semigroup> /** * @category instances * @since 2.11.0 */ export declare const getDifferenceMagma: (E: Eq) => Magma> /** * Use [`fromReadonlyArray`](#fromreadonlyarray) instead. * * @category zone of death * @since 2.5.0 * @deprecated */ export declare const fromArray: (E: Eq) => (as: ReadonlyArray) => ReadonlySet