fp-ts

← Back

Source

chain

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

Added in v1.2.0 (function)

compact

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

Added in v1.12.0 (function)

difference (deprecated)

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

Added in v1.0.0 (function)

Use difference2v instead

difference2v

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

Added in v1.12.0 (function)

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

Added in v1.0.0 (function)

filter

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

Added in v1.0.0 (function)

filterMap

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

Added in v1.12.0 (function)

fromArray

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

Added in v1.2.0 (function)

Create a set from an array

getIntersectionSemigroup

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

Added in v1.0.0 (function)

getSetoid

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

Added in v1.0.0 (function)

getUnionMonoid

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

Added in v1.0.0 (function)

insert

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

Added in v1.0.0 (function)

Insert a value into a set

intersection

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

Added in v1.0.0 (function)

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>

Added in v1.2.0 (function)

Projects a Set through a function

member

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

Added in v1.0.0 (function)

Test if a value is a member of a set

partition

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

Added in v1.2.0 (function)

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 (function)

reduce

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

Added in v1.0.0 (function)

remove

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

Added in v1.0.0 (function)

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>>

Added in v1.12.0 (function)

singleton

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

Added in v1.0.0 (function)

Create a set with one element

some

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

Added in v1.0.0 (function)

subset

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

Added in v1.0.0 (function)

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>

Added in v1.0.0 (function)

union

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

Added in v1.0.0 (function)

Form the union of two sets