Table of contents


Eq (interface)

Signature

export interface Eq<A> {
  readonly equals: (x: A, y: A) => boolean
}

Added in v2.0.0

URI (type alias)

Signature

export type URI = typeof URI

Added in v2.0.0

URI (constant)

Signature

export const URI: "Eq" = ...

Added in v2.0.0

eq (constant)

Signature

export const eq: Contravariant1<URI> = ...

Added in v2.0.0

eqBoolean (constant)

Signature

export const eqBoolean: Eq<boolean> = ...

Added in v2.0.0

eqDate (constant)

Signature

export const eqDate: Eq<Date> = ...

Added in v2.0.0

eqNumber (constant)

Signature

export const eqNumber: Eq<number> = ...

Added in v2.0.0

eqString (constant)

Signature

export const eqString: Eq<string> = ...

Added in v2.0.0

fromEquals (function)

Signature

export function fromEquals<A>(equals: (x: A, y: A) => boolean): Eq<A> { ... }

Added in v2.0.0

getStructEq (function)

Signature

export function getStructEq<O extends { [key: string]: any }>(eqs: { [K in keyof O]: Eq<O[K]> }): Eq<O> { ... }

Added in v2.0.0

getTupleEq (function)

Given a tuple of Eqs returns a Eq for the tuple

Signature

export function getTupleEq<T extends Array<Eq<any>>>(
  ...eqs: T
): Eq<{ [K in keyof T]: T[K] extends Eq<infer A> ? A : never }> { ... }

Example

import { getTupleEq, eqString, eqNumber, eqBoolean } from 'fp-ts/lib/Eq'

const E = getTupleEq(eqString, eqNumber, eqBoolean)
assert.strictEqual(E.equals(['a', 1, true], ['a', 1, true]), true)
assert.strictEqual(E.equals(['a', 1, true], ['b', 1, true]), false)
assert.strictEqual(E.equals(['a', 1, true], ['a', 2, true]), false)
assert.strictEqual(E.equals(['a', 1, true], ['a', 1, false]), false)

Added in v2.0.0

strictEqual (function)

Signature

export function strictEqual<A>(a: A, b: A): boolean { ... }

Added in v2.0.0

contramap (export)

Signature

<A, B>(f: (b: B) => A) => (fa: Eq<A>) => Eq<B>

Added in v2.0.0