package ord
import "github.com/IBM/fp-go/ord"
Index ¶
- func Between[A any](O Ord[A]) func(A, A) func(A) bool
- func Clamp[A any](o Ord[A]) func(A, A) func(A) A
- func Contramap[A, B any](f func(B) A) func(Ord[A]) Ord[B]
- func Geq[A any](O Ord[A]) func(A) func(A) bool
- func Gt[A any](O Ord[A]) func(A) func(A) bool
- func Leq[A any](O Ord[A]) func(A) func(A) bool
- func Lt[A any](o Ord[A]) func(A) func(A) bool
- func Max[A any](o Ord[A]) func(A, A) A
- func MaxSemigroup[A any](o Ord[A]) S.Semigroup[A]
- func Min[A any](o Ord[A]) func(A, A) A
- func MinSemigroup[A any](o Ord[A]) S.Semigroup[A]
- func Monoid[A any]() M.Monoid[Ord[A]]
- func Semigroup[A any]() S.Semigroup[Ord[A]]
- func ToEq[T any](o Ord[T]) E.Eq[T]
- type Ord
Functions ¶
func Between ¶
Between tests whether a value is between a minimum (inclusive) and a maximum (exclusive)
func Clamp ¶
Clamp clamps a value between a minimum and a maximum
func Contramap ¶
Contramap creates an ordering under a transformation function
func Geq ¶
Geq tests whether one value is greater or equal than another
func Gt ¶
*
- Test whether one value is strictly greater than another
func Leq ¶
Leq Tests whether one value is less or equal than another
func Lt ¶
Lt tests whether one value is strictly less than another
func Max ¶
Max takes the maximum of two values. If they are considered equal, the first argument is chosen
func MaxSemigroup ¶
MaxSemigroup returns a semigroup where `concat` will return the maximum, based on the provided order.
func Min ¶
Min takes the minimum of two values. If they are considered equal, the first argument is chosen
func MinSemigroup ¶
MaxSemigroup returns a semigroup where `concat` will return the minimum, based on the provided order.
func Monoid ¶
Monoid implements a two level ordering such that - its `Concat(ord1, ord2)` operation will order first by `ord1`, and then by `ord2` - its `Empty` value is an `Ord` that always considers compared elements equal
func Semigroup ¶
Semigroup implements a two level ordering
func ToEq ¶
ToEq converts an Ord to [E.Eq]
Types ¶
type Ord ¶
func FromCompare ¶
MakeOrd creates an instance of an Ord from a compare function
func FromStrictCompare ¶
FromStrictCompare implements the ordering based on the built in native order
func MakeOrd ¶
MakeOrd creates an instance of an Ord
func Reverse ¶
Reverse creates an inverted ordering
Source Files ¶
- Version
- v1.0.151 (latest)
- Published
- Nov 23, 2024
- Platform
- linux/amd64
- Imports
- 6 packages
- Last checked
- 4 months ago –
Tools for package owners.