fp-ts

← Back

Source

chain

``````<B>(bset: Setoid<B>) => <A>(x: Set<A>, f: (x: A) => Set<B>): Set<B>
``````

compact

``````<A>(S: Setoid<A>): ((fa: Set<Option<A>>) => Set<A>)
``````

difference (deprecated)

``````<A>(S: Setoid<A>): ((x: Set<A>, y: Set<A>) => Set<A>)
``````

difference2v

``````<A>(S: Setoid<A>): ((x: Set<A>, y: Set<A>) => Set<A>)
``````

Form the set difference (`x` - `y`)

Example

``````import { difference2v } from 'fp-ts/lib/Set'
import { setoidNumber } from 'fp-ts/lib/Setoid'

assert.deepEqual(difference2v(setoidNumber)(new Set([1, 2]), new Set([1, 3])), new Set([2]))
``````

every

``````<A>(x: Set<A>, predicate: Predicate<A>): boolean
``````

filter

``````filter<A>(x: Set<A>, predicate: Predicate<A>): Set<A>
``````

filterMap

``````<B>(S: Setoid<B>): (<A>(fa: Set<A>, f: (a: A) => Option<B>) => Set<B>)
``````

fromArray

``````<A>(S: Setoid<A>) => (as: Array<A>): Set<A>
``````

Create a set from an array

getIntersectionSemigroup

``````<A>(S: Setoid<A>): Semigroup<Set<A>>
``````

getSetoid

``````<A>(S: Setoid<A>): Setoid<Set<A>>
``````

getUnionMonoid

``````<A>(S: Setoid<A>): Monoid<Set<A>>
``````

insert

``````<A>(S: Setoid<A>): ((a: A, x: Set<A>) => Set<A>)
``````

Insert a value into a set

intersection

``````<A>(S: Setoid<A>): ((x: Set<A>, y: Set<A>) => Set<A>)
``````

The set of elements which are in both the first and second set

map

``````<B>(bset: Setoid<B>) => <A>(x: Set<A>, f: (x: A) => B): Set<B>
``````

Projects a Set through a function

member

``````<A>(S: Setoid<A>) => (x: Set<A>) => (a: A): boolean
``````

Test if a value is a member of a set

partition

``````partition<A>(x: Set<A>, predicate: Predicate<A>): Separated<Set<A>, Set<A>>
``````

partitionMap

``````<L, R>(SL: Setoid<L>, SR: Setoid<R>) => <A>(
x: Set<A>,
f: (a: A) => Either<L, R>
): Separated<Set<L>, Set<R>>
``````

reduce

``````<A>(O: Ord<A>): (<B>(fa: Set<A>, b: B, f: (b: B, a: A) => B) => B)
``````

remove

``````<A>(S: Setoid<A>) => (a: A, x: Set<A>): Set<A>
``````

Delete a value from a set

separate

``````<L, R>(SL: Setoid<L>, SR: Setoid<R>) => (fa: Set<Either<L, R>>): Separated<Set<L>, Set<R>>
``````

singleton

``````<A>(a: A): Set<A>
``````

Create a set with one element

some

``````<A>(x: Set<A>, predicate: Predicate<A>): boolean
``````

subset

``````<A>(S: Setoid<A>) => (x: Set<A>, y: Set<A>): boolean
``````

`true` if and only if every element in the first set is an element of the second set

toArray

``````<A>(O: Ord<A>) => (x: Set<A>): Array<A>
``````

``````<A>(S: Setoid<A>): ((x: Set<A>, y: Set<A>) => Set<A>)