mirror of
https://github.com/IBM/fp-go.git
synced 2025-07-15 01:24:23 +02:00
fix: build break
Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
@ -21,18 +21,18 @@ import (
|
|||||||
|
|
||||||
func UnionSemigroup[N ~map[K]V, K comparable, V any](s S.Semigroup[V]) S.Semigroup[N] {
|
func UnionSemigroup[N ~map[K]V, K comparable, V any](s S.Semigroup[V]) S.Semigroup[N] {
|
||||||
return S.MakeSemigroup(func(first N, second N) N {
|
return S.MakeSemigroup(func(first N, second N) N {
|
||||||
return union(s, first, second)
|
return union[N, K, V](S.ToMagma(s), first, second)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func UnionLastSemigroup[N ~map[K]V, K comparable, V any]() S.Semigroup[N] {
|
func UnionLastSemigroup[N ~map[K]V, K comparable, V any]() S.Semigroup[N] {
|
||||||
return S.MakeSemigroup(func(first N, second N) N {
|
return S.MakeSemigroup(func(first N, second N) N {
|
||||||
return unionLast(first, second)
|
return unionLast[N, K, V](first, second)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func UnionFirstSemigroup[N ~map[K]V, K comparable, V any]() S.Semigroup[N] {
|
func UnionFirstSemigroup[N ~map[K]V, K comparable, V any]() S.Semigroup[N] {
|
||||||
return S.MakeSemigroup(func(first N, second N) N {
|
return S.MakeSemigroup(func(first N, second N) N {
|
||||||
return unionLast(second, first)
|
return unionLast[N, K, V](second, first)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -59,3 +59,8 @@ func First[A any]() Semigroup[A] {
|
|||||||
func Last[A any]() Semigroup[A] {
|
func Last[A any]() Semigroup[A] {
|
||||||
return MakeSemigroup(F.Second[A, A])
|
return MakeSemigroup(F.Second[A, A])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ToMagma converts a semigroup to a magma
|
||||||
|
func ToMagma[A any](s Semigroup[A]) M.Magma[A] {
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user