Eq overview

Eq is a data type that determines if two values of the same type are equal, and abides the following laws:

  1. Reflexivity: x === x
  2. Symmetry: x === y <=> y === x
  3. Transitivity: x === y && y === z => x === z

Added in v2.0.0


Table of contents


Combinators

and

Signature

export declare const and: <A>(that: Eq<A>) => (self: Eq<A>) => Eq<A>

Added in v2.0.0

or

Signature

export declare const or: <A>(that: Eq<A>) => (self: Eq<A>) => Eq<A>

Added in v2.0.0

Constructors

fromEquals

Signature

export declare const fromEquals: <A>(equals: (x: A, y: A) => boolean) => Eq<A>

Added in v2.0.0

Instance Methods

contramap

Signature

export declare const contramap: <A, B>(f: (b: B) => A) => (fa: Eq<A>) => Eq<B>

Added in v2.0.0

imap

Signature

export declare const imap: <A, B>(f: (a: A) => B, g: (b: B) => A) => (fa: Eq<A>) => Eq<B>

Added in v2.0.0

Instances

Contravariant

Signature

export declare const Contravariant: Contravariant1<'schemata-ts/Eq'>

Added in v2.0.0

Invariant

Signature

export declare const Invariant: Invariant1<'schemata-ts/Eq'>

Added in v2.0.0

always

Signature

export declare const always: Eq<unknown>

Added in v2.0.0

eqStrict

Signature

export declare const eqStrict: Eq<unknown>

Added in v2.0.0

Interpreters

deriveEq

Interprets a schema as an Eq instance.

Signature

export declare const deriveEq: Interpreter<I.SchemableLambda>

Added in v2.0.0

Model

Eq (interface)

Represents a typeclass and data type that determines if two values of the same type are equal, and follows the following laws:

  1. Reflexivity: x === x
  2. Symmetry: x === y <=> y === x
  3. Transitivity: x === y && y === z => x === z

Signature

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

Added in v2.0.0

URI

URI

Signature

export declare const URI: 'schemata-ts/Eq'

Added in v2.0.0

URI (type alias)

Signature

export type URI = typeof URI

Added in v2.0.0