1
0
mirror of https://github.com/IBM/fp-go.git synced 2025-08-10 22:31:32 +02:00

Merge pull request #21 from IBM/cleue-fix-buildbreak

fix: build break
This commit is contained in:
Carsten Leue
2023-08-10 13:24:28 +02:00
committed by GitHub
3 changed files with 14 additions and 6 deletions

View File

@@ -17,22 +17,25 @@ on:
env:
# Currently no way to detect automatically
DEFAULT_BRANCH: main
GO_VERSION: 1.20.5 # renovate: datasource=golang-version depName=golang
GO_VERSION: 1.20.6 # renovate: datasource=golang-version depName=golang
NODE_VERSION: 18
DRY_RUN: true
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.20.x', '1.21.x' ]
steps:
# full checkout for semantic-release
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 0
- name: Set up go ${{env.GO_VERSION}}
- name: Set up go ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{env.GO_VERSION}}
go-version: ${{ matrix.go-version }}
-
name: Tests
run: |

View File

@@ -21,18 +21,18 @@ import (
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 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] {
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] {
return S.MakeSemigroup(func(first N, second N) N {
return unionLast(second, first)
return unionLast[N, K, V](second, first)
})
}

View File

@@ -59,3 +59,8 @@ func First[A any]() Semigroup[A] {
func Last[A any]() Semigroup[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
}