mirror of
https://github.com/IBM/fp-go.git
synced 2025-11-27 22:28:29 +02:00
18 lines
603 B
Go
18 lines
603 B
Go
package generic
|
|
|
|
import (
|
|
ET "github.com/IBM/fp-go/either"
|
|
EQ "github.com/IBM/fp-go/eq"
|
|
G "github.com/IBM/fp-go/readerio/generic"
|
|
)
|
|
|
|
// Eq implements the equals predicate for values contained in the IOEither monad
|
|
func Eq[GEA ~func(R) GIOA, GIOA ~func() ET.Either[E, A], R, E, A any](eq EQ.Eq[ET.Either[E, A]]) func(R) EQ.Eq[GEA] {
|
|
return G.Eq[GEA](eq)
|
|
}
|
|
|
|
// FromStrictEquals constructs an `Eq` from the canonical comparison function
|
|
func FromStrictEquals[GEA ~func(R) GIOA, GIOA ~func() ET.Either[E, A], R any, E, A comparable]() func(R) EQ.Eq[GEA] {
|
|
return Eq[GEA](ET.FromStrictEquals[E, A]())
|
|
}
|