Documentation ¶
Index ¶
- Constants
- Variables
- func ComparatorToCmp[A any](comparator Comparator[A]) func(A, A) int
- func Equal[T Eq[T]](a T, b T) bool
- func EqualComparable[T comparable](a T, b T) bool
- func Fst[A, B any](p *Pair[A, B]) A
- func GreaterThan[T Ord[T]](a T, b T) bool
- func GreaterThanOrEqual[T Ord[T]](a T, b T) bool
- func LessThan[T Ord[T]](a T, b T) bool
- func LessThanOrEqual[T Ord[T]](a T, b T) bool
- func Max[T Ord[T]](a T, b T) T
- func Min[T Ord[T]](a T, b T) T
- func NotEqual[T Eq[T]](a T, b T) bool
- func NotEqualComparable[T comparable](a T, b T) bool
- func Snd[A, B any](p *Pair[A, B]) B
- func UnboxEq[A comparable](v *EqBox[A]) A
- func UnboxEqBy[A any](v *EqBoxBy[A]) A
- func UnboxOrd[A constraints.Ordered](v *OrdBox[A]) A
- func UnboxOrdBy[A any](v *OrdBoxBy[A]) A
- func UnwrapBool(a Bool) bool
- func UnwrapComplex128(a Complex128) complex128
- func UnwrapComplex64(a Complex64) complex64
- func UnwrapFloat32(a Float32) float32
- func UnwrapFloat64(a Float64) float64
- func UnwrapInt(a Int) int
- func UnwrapInt16(a Int16) int16
- func UnwrapInt32(a Int32) int32
- func UnwrapInt64(a Int64) int64
- func UnwrapInt8(a Int8) int8
- func UnwrapString(a String) string
- func UnwrapUint(a Uint) uint
- func UnwrapUint16(a Uint16) uint16
- func UnwrapUint32(a Uint32) uint32
- func UnwrapUint64(a Uint64) uint64
- func UnwrapUint8(a Uint8) uint8
- func UnwrapUintptr(a Uintptr) uintptr
- type Bool
- type Comparator
- func CompareOn[A any, B constraints.Ordered](on func(A) B) Comparator[A]
- func CompareOnBy[A any, B any](on func(A) B, by Comparator[B]) Comparator[A]
- func CompareOnOrd[A any, B Ord[B]](on func(A) B) Comparator[A]
- func ComparePair[A constraints.Ordered, B constraints.Ordered]() Comparator[*Pair[A, B]]
- func ComparePairBy[A, B any](fst Comparator[A], snd Comparator[B]) Comparator[*Pair[A, B]]
- func ComparePairOrd[A Ord[A], B Ord[B]]() Comparator[*Pair[A, B]]
- func CompareReverse[A any](compare Comparator[A]) Comparator[A]
- func ConstComparator[T any](a Ordering) Comparator[T]
- type Complex128
- type Complex64
- type Eq
- type EqBox
- type EqBoxBy
- type Equaler
- func EqualOn[A any, B comparable](on func(A) B) Equaler[A]
- func EqualOnBy[A any, B any](on func(A) B, by Equaler[B]) Equaler[A]
- func EqualOnEq[A any, B Eq[B]](on func(A) B) Equaler[A]
- func EqualPair[A comparable, B comparable]() Equaler[*Pair[A, B]]
- func EqualPairBy[A, B any](fst Equaler[A], snd Equaler[B]) Equaler[*Pair[A, B]]
- func EqualPairEq[A Eq[A], B Eq[B]]() Equaler[*Pair[A, B]]
- type F1
- type F2
- type F3
- type F4
- type F5
- type Float32
- type Float64
- type Int
- type Int16
- type Int32
- type Int64
- type Int8
- type Ord
- type OrdBox
- type OrdBoxBy
- type Ordering
- type Pair
- type String
- type Uint
- type Uint16
- type Uint32
- type Uint64
- type Uint8
- type Uintptr
- type Unit
Constants ¶
View Source
const ( OrderingLessThan = "OrderingLessThan" OrderingEqual = "OrderingEqual" OrderingGreaterThan = "OrderingGreaterThan" )
Variables ¶
View Source
var UnitC = &Unit{}
Functions ¶
func ComparatorToCmp ¶ added in v0.2.9
func ComparatorToCmp[A any](comparator Comparator[A]) func(A, A) int
ComparatorToCmp converts a Comparator to a `cmp` function needed for using golang's package `golang.org/x/exp/slices` sort functionality cmp(a, b) should return a negative number when a < b, a positive number when a > b and zero when a == b.
func EqualComparable ¶ added in v0.2.7
func EqualComparable[T comparable](a T, b T) bool
func GreaterThan ¶
func GreaterThanOrEqual ¶
func LessThanOrEqual ¶
func NotEqualComparable ¶ added in v0.2.7
func NotEqualComparable[T comparable](a T, b T) bool
func UnboxEq ¶ added in v0.2.7
func UnboxEq[A comparable](v *EqBox[A]) A
func UnboxOrd ¶ added in v0.2.7
func UnboxOrd[A constraints.Ordered](v *OrdBox[A]) A
func UnboxOrdBy ¶ added in v0.2.9
func UnwrapBool ¶
func UnwrapComplex128 ¶
func UnwrapComplex128(a Complex128) complex128
func UnwrapComplex64 ¶
func UnwrapFloat32 ¶
func UnwrapFloat64 ¶
func UnwrapInt16 ¶
func UnwrapInt32 ¶
func UnwrapInt64 ¶
func UnwrapInt8 ¶
func UnwrapString ¶
func UnwrapUint ¶
func UnwrapUint16 ¶
func UnwrapUint32 ¶
func UnwrapUint64 ¶
func UnwrapUint8 ¶
func UnwrapUintptr ¶
Types ¶
type Comparator ¶
func CompareOn ¶ added in v0.2.7
func CompareOn[A any, B constraints.Ordered](on func(A) B) Comparator[A]
func CompareOnBy ¶ added in v0.3.1
func CompareOnBy[A any, B any](on func(A) B, by Comparator[B]) Comparator[A]
func CompareOnOrd ¶ added in v0.2.4
func CompareOnOrd[A any, B Ord[B]](on func(A) B) Comparator[A]
func ComparePair ¶ added in v0.2.7
func ComparePair[A constraints.Ordered, B constraints.Ordered]() Comparator[*Pair[A, B]]
func ComparePairBy ¶ added in v0.2.7
func ComparePairBy[A, B any](fst Comparator[A], snd Comparator[B]) Comparator[*Pair[A, B]]
func ComparePairOrd ¶ added in v0.2.7
func ComparePairOrd[A Ord[A], B Ord[B]]() Comparator[*Pair[A, B]]
func CompareReverse ¶ added in v0.2.4
func CompareReverse[A any](compare Comparator[A]) Comparator[A]
func ConstComparator ¶ added in v0.1.1
func ConstComparator[T any](a Ordering) Comparator[T]
type Complex128 ¶
type Complex128 complex128
func WrapComplex128 ¶
func WrapComplex128(a complex128) Complex128
func (Complex128) Equal ¶
func (a Complex128) Equal(b Complex128) bool
type EqBox ¶ added in v0.2.7
type EqBox[A comparable] struct { Value A }
EqBox allows any comparable to be used as an Eq
func BoxEq ¶ added in v0.2.7
func BoxEq[A comparable](a A) *EqBox[A]
type Equaler ¶
func EqualOn ¶ added in v0.3.0
func EqualOn[A any, B comparable](on func(A) B) Equaler[A]
func EqualPair ¶ added in v0.2.7
func EqualPair[A comparable, B comparable]() Equaler[*Pair[A, B]]
func EqualPairBy ¶ added in v0.2.7
type OrdBox ¶ added in v0.2.7
type OrdBox[A constraints.Ordered] struct { Value A }
OrdBox allows any constraints.Ordered to be used as an Ord
func BoxOrd ¶ added in v0.2.7
func BoxOrd[A constraints.Ordered](a A) *OrdBox[A]
type OrdBoxBy ¶ added in v0.2.9
type OrdBoxBy[A any] struct { Value A Eq Equaler[A] Ord Comparator[A] }
OrdBoxBy allows any type to be used as an Ord. Note that since each value carries its own Equaler and Comparator, you'll get weird results if you mix OrdBoxBys which have different Equalers or Comparators. So don't do this.
func BoxOrdBy ¶ added in v0.2.9
func BoxOrdBy[A any](a A, eq Equaler[A], ord Comparator[A]) *OrdBoxBy[A]
type Ordering ¶
type Ordering string
func CompareBool ¶ added in v0.2.7
func CompareOrdered ¶ added in v0.2.7
func CompareOrdered[A constraints.Ordered](a A, b A) Ordering
func FlipOrdering ¶
Click to show internal directories.
Click to hide internal directories.