mirror of
https://github.com/IBM/fp-go.git
synced 2025-11-23 22:14:53 +02:00
12 lines
274 B
Go
12 lines
274 B
Go
package constant
|
|
|
|
import (
|
|
"github.com/IBM/fp-go/v2/function"
|
|
M "github.com/IBM/fp-go/v2/monoid"
|
|
)
|
|
|
|
// Monoid returns a [M.Monoid] that returns a constant value in all operations
|
|
func Monoid[A any](a A) M.Monoid[A] {
|
|
return M.MakeMonoid(function.Constant2[A, A](a), a)
|
|
}
|