mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-18 21:35:24 +01:00
fn: add curried (in)equality functions
This commit is contained in:
parent
c4df2f1dce
commit
9c30bce10c
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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user