Skip to content

Latest commit

 

History

History
292 lines (176 loc) · 6.43 KB

Set.md

File metadata and controls

292 lines (176 loc) · 6.43 KB
id title
Set
Module Set

← Index

Source

chain

Signature (function) Source

export const chain = <B>(bset: Setoid<B>) => <A>(x: Set<A>, f: (x: A) => Set<B>): Set<B> => { ... }

Added in v1.2.0

compact

Signature (function) Source

export const compact = <A>(S: Setoid<A>): ((fa: Set<Option<A>>) => Set<A>) => { ... }

Added in v1.12.0

difference (deprecated)

Use difference2v instead

Signature (function) Source

export const difference = <A>(S: Setoid<A>): ((x: Set<A>, y: Set<A>) => Set<A>) => { ... }

Added in v1.0.0

difference2v

Form the set difference (x - y)

Signature (function) Source

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

every

Signature (function) Source

export const every = <A>(x: Set<A>, predicate: Predicate<A>): boolean => { ... }

Added in v1.0.0

filter

Signature (function) Source

export function filter<A>(x: Set<A>, predicate: Predicate<A>): Set<A>  { ... }

Added in v1.0.0

filterMap

Signature (function) Source

export const filterMap = <B>(S: Setoid<B>): (<A>(fa: Set<A>, f: (a: A) => Option<B>) => Set<B>) => { ... }

Added in v1.12.0

fromArray

Create a set from an array

Signature (function) Source

export const fromArray = <A>(S: Setoid<A>) => (as: Array<A>): Set<A> => { ... }

Added in v1.2.0

getIntersectionSemigroup

Signature (function) Source

export const getIntersectionSemigroup = <A>(S: Setoid<A>): Semigroup<Set<A>> => { ... }

Added in v1.0.0

getSetoid

Signature (function) Source

export const getSetoid = <A>(S: Setoid<A>): Setoid<Set<A>> => { ... }

Added in v1.0.0

getUnionMonoid

Signature (function) Source

export const getUnionMonoid = <A>(S: Setoid<A>): Monoid<Set<A>> => { ... }

Added in v1.0.0

insert

Insert a value into a set

Signature (function) Source

export const insert = <A>(S: Setoid<A>): ((a: A, x: Set<A>) => Set<A>) => { ... }

Added in v1.0.0

intersection

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

Signature (function) Source

export const intersection = <A>(S: Setoid<A>): ((x: Set<A>, y: Set<A>) => Set<A>) => { ... }

Added in v1.0.0

map

Projects a Set through a function

Signature (function) Source

export const map = <B>(bset: Setoid<B>) => <A>(x: Set<A>, f: (x: A) => B): Set<B> => { ... }

Added in v1.2.0

member

Test if a value is a member of a set

Signature (function) Source

export const member = <A>(S: Setoid<A>) => (x: Set<A>) => (a: A): boolean => { ... }

Added in v1.0.0

partition

Signature (function) Source

export function partition<A>(x: Set<A>, predicate: Predicate<A>): Separated<Set<A>, Set<A>>  { ... }

Added in v1.2.0

partitionMap

Signature (function) Source

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

Signature (function) Source

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

Delete a value from a set

Signature (function) Source

export const remove = <A>(S: Setoid<A>) => (a: A, x: Set<A>): Set<A> => { ... }

Added in v1.0.0

separate

Signature (function) Source

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

Create a set with one element

Signature (function) Source

export const singleton = <A>(a: A): Set<A> => { ... }

Added in v1.0.0

some

Signature (function) Source

export const some = <A>(x: Set<A>, predicate: Predicate<A>): boolean => { ... }

Added in v1.0.0

subset

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

Signature (function) Source

export const subset = <A>(S: Setoid<A>) => (x: Set<A>, y: Set<A>): boolean => { ... }

Added in v1.0.0

toArray

Signature (function) Source

export const toArray = <A>(O: Ord<A>) => (x: Set<A>): Array<A> => { ... }

Added in v1.0.0

union

Form the union of two sets

Signature (function) Source

export const union = <A>(S: Setoid<A>): ((x: Set<A>, y: Set<A>) => Set<A>) => { ... }

Added in v1.0.0