Skip to main content
Module

x/fun/set.ts

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Go to Latest
import * as fun from "https://deno.land/x/fun@v.2.0.0-alpha.11/set.ts";

ReadonlySet is a readonly product structure over objects and it operates on object equality for deduplication.

Variables

The canonical implementation of Applicative for ReadonlySet. It contains the methods of, ap, and map.

The canonical implementation of Apply for ReadonlySet. It contains the methods ap and map.

The canonical implementation of Applicative for ReadonlySet. It contains the methods ap, map, and chain

The canonical implementation of Filterable for ReadonlySet. It contains the methods filter, filterMap, partition, and partitionMap.

The canonical implementation of Foldable for ReadonlySet. It contains the method reduce.

The canonical implementation of Functor for ReadonlySet. It contains the method map.

The canonical implementation of Monad for ReadonlySet. It contains the methods of, ap, map, join, and chain.

The canonical implementation of Traversable for ReadonlySet. It contains the methods map, reduce, and traverse.

Functions

Given a ReadonlySet of functions A -> I and a ReadonlySet return a ReadonlySet by applying every function to every value A.

Given a function A -> ReadonlySet and a ReadonlySet return a ReadonlySet created by applying the function to every value A and joining all the resulting ReadonlySets.

Given an instance of Eq create a function that will take a ReadonlySet and return a new ReadonlySet where any members that are equal are deduplicated.

Copies an existing ReadonlySet into a new ReadonlySet, keeping references to the original members.

Given an insuance of Eq create a function that takes a value A and returns a predicate over ReadonlySet the returns true if there are any members of the set that are equal to the value.

Given an instance of Eq create a function that uakes a ReadonlySet and returns a predicate over a value A the returns true if the value is a member of the set. This is like elem but with the set and value parameters swapped.

Constructs a new ReadonlySet over type A that conuains no values.

Operates like Array.every, testing values in a ReadonlySet with a Predicate until either the predicate returns false for a value or all of the values have been tested as true. Shortcircuits on the first value that returns false. This is the dual of some.

Given a Refinement or Predicate over A and a ReadonlySet return a new ReadonlySet with only values for which the predicate or refinement return true.

Given a function A -> Option and a ReadonlySet return a ReadonlySet by applying the function to all values A. Any Nones will not enter the resultant set while Some values will. This is effectively filtering and mapping simultaneously.

Given an instance of Eq return Eq<ReadonlySet>.

Given an instance of Show return an instance of Show<ReadonlySet>.

Given an instance of Eq create a Monoid<ReadonlySet> where concat creates a union of two ReadonlySets.

Given an instance of Eq return a function that takes two ReadonlySets and returns a new set with only the elements that exist in both sets.

Given an instance of Eq return a function second => first => boolean that returns true when every member of first is in second.

Given a ReadonlySet of ReadonlySet, flatten all of the inner sets and return a ReadonlySet.

Given a function A -> I and a ReadonlySet return a new ReadonlySet where the values were created by passing each A through the A -> I function.

Given a value A create a new ReadonlySet that contains that value.

Given a Predicate or Refinement over A and a ReadonlySet return a Pair with a first value being a ReadonlySet of values that return true when applied to the refinement or predicate and a second value being a ReadonlySet of values that return false when applied to the predicate.

Given a function A -> Either<J, I> and a ReadonlySet return a Pair(ReadonlySet, ReadonlySet) by applying every value A in the set to the partitioning function.

Reduce a ReadonlySet to a value O by iterating over the values of the set and collecting them with the reducing function.

Constructs a new ReadonlySet from an arbitrary number of values.

Operates like Array.some, testing values in a ReadonlySet with a Predicate until either the predicate returns true for a value or all of the values have been tested. Shortcircuits on the first value that returns true. This is the dual of every.

Traverse a ReadonlySet value by value, applying a function A -> V, then collecting all of the I values into ReadonlySet and returning V<ReadonlySet>. In concrete terms this can take ReadonlySet<Option> and turn it into Option<ReadonlySet> and other ADT inversions.

Given an instance of Eq return a function that takes two ReadonlySets and merges them into a new ReadonlySet that contains all the elements from both sets.

Interfaces

Specifies ReadonlySet as a Higher Kinded Type, with covariant parameter A corresponding to the 0th index of any substitutions.

Type Aliases

Extract the inner type of a ReadonlySet