package eq

import "github.com/IBM/fp-go/eq"

Index

Functions

func Contramap

func Contramap[A, B any](f func(b B) A) func(Eq[A]) Eq[B]

Contramap implements an Equals predicate based on a mapping

func Equals

func Equals[T any](eq Eq[T]) func(T) func(T) bool

Equals returns a predicate to test if one value equals the other under an equals predicate

func Monoid

func Monoid[A any]() M.Monoid[Eq[A]]

func Semigroup

func Semigroup[A any]() S.Semigroup[Eq[A]]

Types

type Eq

type Eq[T any] interface {
	Equals(x, y T) bool
}

func Empty

func Empty[T any]() Eq[T]

Empty returns the equals predicate that is always true

func FromEquals

func FromEquals[T any](c func(x, y T) bool) Eq[T]

FromEquals constructs an [EQ.Eq] from the comparison function

func FromStrictEquals

func FromStrictEquals[T comparable]() Eq[T]

FromStrictEquals constructs an [EQ.Eq] from the canonical comparison function

Source Files

contramap.go eq.go monoid.go

Directories

PathSynopsis
eq/testing
Version
v1.0.151 (latest)
Published
Nov 23, 2024
Platform
linux/amd64
Imports
3 packages
Last checked
5 months ago

Tools for package owners.