2023-07-14 17:30:58 +02:00
|
|
|
package generic
|
|
|
|
|
|
|
|
|
|
import (
|
2023-07-18 15:57:54 +02:00
|
|
|
ET "github.com/IBM/fp-go/either"
|
|
|
|
|
EQ "github.com/IBM/fp-go/eq"
|
|
|
|
|
G "github.com/IBM/fp-go/io/generic"
|
2023-07-14 17:30:58 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Eq implements the equals predicate for values contained in the IOEither monad
|
|
|
|
|
func Eq[GA ~func() ET.Either[E, A], E, A any](eq EQ.Eq[ET.Either[E, A]]) EQ.Eq[GA] {
|
|
|
|
|
return G.Eq[GA](eq)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FromStrictEquals constructs an `Eq` from the canonical comparison function
|
|
|
|
|
func FromStrictEquals[GA ~func() ET.Either[E, A], E, A comparable]() EQ.Eq[GA] {
|
|
|
|
|
return Eq[GA](ET.FromStrictEquals[E, A]())
|
|
|
|
|
}
|