fn: add curried (in)equality functions

This commit is contained in:
Keagan McClelland committed 2024-07-10 15:37:27 -07:00
1 parent c4df2f1dce
commit 9c30bce10c
1 file changed
+16
+16
View File
@@ -28,3 +28,19 @@ func Const[A, B any](a A) func(B) A {
return a
}
}
// Eq is a curried function that returns true if its eventual two arguments are
// equal.
func Eq[A comparable](x A) func(A) bool {
return func(y A) bool {
return x == y
}
}
// Neq is a curried function that returns true if its eventual two arguments are
// not equal.
func Neq[A comparable](x A) func(A) bool {
return func(y A) bool {
return x != y
}
}