diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 030b891..96a165f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: | diff --git a/record/generic/semigroup.go b/record/generic/semigroup.go index 8faaa8d..f1de1e7 100644 --- a/record/generic/semigroup.go +++ b/record/generic/semigroup.go @@ -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) }) } diff --git a/semigroup/semigroup.go b/semigroup/semigroup.go index 3eb8d76..298035c 100644 --- a/semigroup/semigroup.go +++ b/semigroup/semigroup.go @@ -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 +}