1
0
mirror of https://github.com/IBM/fp-go.git synced 2025-11-27 22:28:29 +02:00
Files
fp-go/reader/semigroup.go
Dr. Carsten Leue 84c3e3ff88 fix: add support for context sensitive readers
Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
2023-07-14 23:52:14 +02:00

26 lines
591 B
Go

package reader
import (
M "github.com/ibm/fp-go/monoid"
S "github.com/ibm/fp-go/semigroup"
)
func ApplySemigroup[R, A any](
_map func(func(R) A, func(A) func(A) A) func(R, func(A) A),
_ap func(func(R, func(A) A), func(R) A) func(R) A,
s S.Semigroup[A],
) S.Semigroup[func(R) A] {
return S.ApplySemigroup(_map, _ap, s)
}
func ApplicativeMonoid[R, A any](
_of func(A) func(R) A,
_map func(func(R) A, func(A) func(A) A) func(R, func(A) A),
_ap func(func(R, func(A) A), func(R) A) func(R) A,
m M.Monoid[A],
) M.Monoid[func(R) A] {
return M.ApplicativeMonoid(_of, _map, _ap, m)
}