Table of contents
- empty (constant)
- chain (function)
- compact (function)
difference(function)- difference2v (function)
- elem (function)
- every (function)
- filter (function)
- filterMap (function)
- foldMap (function)
- fromArray (function)
- getIntersectionSemigroup (function)
- getSetoid (function)
- getUnionMonoid (function)
- insert (function)
- intersection (function)
- map (function)
member(function)- partition (function)
- partitionMap (function)
- reduce (function)
- remove (function)
- separate (function)
- singleton (function)
- some (function)
- subset (function)
- toArray (function)
- union (function)
empty (constant)
Signature
export const empty: Set<never> = ...
Added in v1.14.0
chain (function)
Signature
export const chain = <B>(S: Setoid<B>): (<A>(set: Set<A>, f: (x: A) => Set<B>) => Set<B>) => ...
Added in v1.2.0
compact (function)
Signature
export const compact = <A>(S: Setoid<A>): ((fa: Set<Option<A>>) => Set<A>) => ...
Added in v1.12.0
difference (function)
Use difference2v
instead
Signature
export const difference = <A>(S: Setoid<A>): ((x: Set<A>, y: Set<A>) => Set<A>) => ...
Added in v1.0.0
difference2v (function)
Form the set difference (x
- y
)
Signature
export const difference2v = <A>(S: Setoid<A>): ((x: Set<A>, y: Set<A>) => Set<A>) => ...
Example
import { difference2v } from 'fp-ts/lib/Set'
import { setoidNumber } from 'fp-ts/lib/Setoid'
assert.deepStrictEqual(difference2v(setoidNumber)(new Set([1, 2]), new Set([1, 3])), new Set([2]))
Added in v1.12.0
elem (function)
Test if a value is a member of a set
Signature
export const elem = <A>(S: Setoid<A>) => (a: A, x: Set<A>): boolean => ...
Added in v1.14.0
every (function)
Signature
export const every = <A>(x: Set<A>, predicate: Predicate<A>): boolean => ...
Added in v1.0.0
filter (function)
Signature
export function filter<A, B extends A>(x: Set<A>, predicate: Refinement<A, B>): Set<B>
export function filter<A>(x: Set<A>, predicate: Predicate<A>): Set<A> { ... }
Added in v1.0.0
filterMap (function)
Signature
export const filterMap = <B>(S: Setoid<B>): (<A>(fa: Set<A>, f: (a: A) => Option<B>) => Set<B>) => ...
Added in v1.12.0
foldMap (function)
Signature
export const foldMap = <A, M>(O: Ord<A>, M: Monoid<M>): ((fa: Set<A>, f: (a: A) => M) => M) => ...
Added in v1.14.0
fromArray (function)
Create a set from an array
Signature
export const fromArray = <A>(S: Setoid<A>) => (as: Array<A>): Set<A> => ...
Added in v1.2.0
getIntersectionSemigroup (function)
Signature
export const getIntersectionSemigroup = <A>(S: Setoid<A>): Semigroup<Set<A>> => ...
Added in v1.0.0
getSetoid (function)
Signature
export const getSetoid = <A>(S: Setoid<A>): Setoid<Set<A>> => ...
Added in v1.0.0
getUnionMonoid (function)
Signature
export const getUnionMonoid = <A>(S: Setoid<A>): Monoid<Set<A>> => ...
Added in v1.0.0
insert (function)
Insert a value into a set
Signature
export const insert = <A>(S: Setoid<A>): ((a: A, x: Set<A>) => Set<A>) => ...
Added in v1.0.0
intersection (function)
The set of elements which are in both the first and second set
Signature
export const intersection = <A>(S: Setoid<A>): ((x: Set<A>, y: Set<A>) => Set<A>) => ...
Added in v1.0.0
map (function)
Projects a Set through a function
Signature
export const map = <B>(S: Setoid<B>): (<A>(set: Set<A>, f: (x: A) => B) => Set<B>) => ...
Added in v1.2.0
member (function)
Use elem
instead
Signature
export const member = <A>(S: Setoid<A>): ((set: Set<A>) => (a: A) => boolean) => ...
Added in v1.0.0
partition (function)
Signature
export function partition<A, B extends A>(x: Set<A>, predicate: Refinement<A, B>): Separated<Set<A>, Set<B>>
export function partition<A>(x: Set<A>, predicate: Predicate<A>): Separated<Set<A>, Set<A>> { ... }
Added in v1.2.0
partitionMap (function)
Signature
export const partitionMap = <L, R>(SL: Setoid<L>, SR: Setoid<R>) => <A>(
x: Set<A>,
f: (a: A) => Either<L, R>
): Separated<Set<L>, Set<R>> => ...
Added in v1.2.0
reduce (function)
Signature
export const reduce = <A>(O: Ord<A>): (<B>(fa: Set<A>, b: B, f: (b: B, a: A) => B) => B) => ...
Added in v1.0.0
remove (function)
Delete a value from a set
Signature
export const remove = <A>(S: Setoid<A>) => (a: A, x: Set<A>): Set<A> => ...
Added in v1.0.0
separate (function)
Signature
export const separate = <L, R>(SL: Setoid<L>, SR: Setoid<R>) => (fa: Set<Either<L, R>>): Separated<Set<L>, Set<R>> => ...
Added in v1.12.0
singleton (function)
Create a set with one element
Signature
export const singleton = <A>(a: A): Set<A> => ...
Added in v1.0.0
some (function)
Signature
export const some = <A>(x: Set<A>, predicate: Predicate<A>): boolean => ...
Added in v1.0.0
subset (function)
true
if and only if every element in the first set is an element of the second set
Signature
export const subset = <A>(S: Setoid<A>): ((x: Set<A>, y: Set<A>) => boolean) => ...
Added in v1.0.0
toArray (function)
Signature
export const toArray = <A>(O: Ord<A>) => (x: Set<A>): Array<A> => ...
Added in v1.0.0
union (function)
Form the union of two sets
Signature
export const union = <A>(S: Setoid<A>): ((x: Set<A>, y: Set<A>) => Set<A>) => ...
Added in v1.0.0