1
0
mirror of https://github.com/IBM/fp-go.git synced 2025-11-29 22:38:29 +02:00
Files
fp-go/internal/eq/eq.go
Dr. Carsten Leue 5020437b6a fix: add ioeither
Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
2023-07-14 17:30:58 +02:00

20 lines
420 B
Go

package eq
import (
EQ "github.com/ibm/fp-go/eq"
F "github.com/ibm/fp-go/function"
)
// Eq implements an equals predicate on the basis of `map` and `ap`
func Eq[HKTA, HKTABOOL, HKTBOOL, A any](
fmap func(HKTA, func(A) func(A) bool) HKTABOOL,
fap func(HKTABOOL, HKTA) HKTBOOL,
e EQ.Eq[A],
) func(l, r HKTA) HKTBOOL {
c := F.Curry2(e.Equals)
return func(fl, fr HKTA) HKTBOOL {
return fap(fmap(fl, c), fr)
}
}