UNPKG

@jsoldi/hkt

Version:

Higher kinded types for typescript and a few utility monads.

27 lines 1.54 kB
import { KRoot } from "../core/hkt.js"; import { IMonadPlus } from "../classes/monadPlus.js"; /** Higher-kinded Set type. */ export interface KSet extends KRoot { readonly 0: unknown; readonly body: Set<this[0]>; } /** The set interface, providing a set of functions for working with sets. */ export interface ISet extends IMonadPlus<KSet> { /** Produces a Set containing all the elements in the first set and also in the second set. */ union: <A>(fa: Set<A>) => (fb: Set<A>) => Set<A>; /** Produces a Set containing all the elements which are both in the first and second set. */ intersection: <A>(fa: Set<A>) => (fb: Set<A>) => Set<A>; /** Produces a Set containing all the elements in the first set but not in the second set. */ difference: <A>(fa: Set<A>) => (fb: Set<A>) => Set<A>; /** Produces a Set containing all the elements which are in either the first or second set but not both. */ symmetricDifference: <A>(fa: Set<A>) => (fb: Set<A>) => Set<A>; /** Determines if the first set is a subset of the second set. */ isSubsetOf: <A>(fa: Set<A>) => (fb: Set<A>) => boolean; /** Determines if the first set is a superset of the second set. */ isSupersetOf: <A>(fa: Set<A>) => (fb: Set<A>) => boolean; /** Determines if the first set is disjoint from the second set. */ isDisjointFrom: <A>(fa: Set<A>) => (fb: Set<A>) => boolean; } /** The set module, providing a set of functions for working with sets. */ export declare const set: ISet; //# sourceMappingURL=set.d.ts.map