mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-18 19:41:21 +02:00
fn: add curried (in)equality functions
This commit is contained in:
16
fn/fn.go
16
fn/fn.go
@@ -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
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user