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

fix: add ioeither

Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
Dr. Carsten Leue
2023-07-14 17:30:58 +02:00
parent e350f70659
commit 5020437b6a
80 changed files with 5436 additions and 2110 deletions

5
bytes/bytes.go Normal file
View File

@@ -0,0 +1,5 @@
package bytes
func ToString(a []byte) string {
return string(a)
}

19
bytes/monoid.go Normal file
View File

@@ -0,0 +1,19 @@
package bytes
import (
"bytes"
A "github.com/ibm/fp-go/array"
O "github.com/ibm/fp-go/ord"
)
var (
// monoid for byte arrays
Monoid = A.Monoid[byte]()
// ConcatAll concatenates all bytes
ConcatAll = A.ArrayConcatAll[byte]
// Ord implements the default ordering on bytes
Ord = O.MakeOrd(bytes.Compare, bytes.Equal)
)

11
bytes/monoid_test.go Normal file
View File

@@ -0,0 +1,11 @@
package bytes
import (
"testing"
M "github.com/ibm/fp-go/monoid/testing"
)
func TestMonoid(t *testing.T) {
M.AssertLaws(t, Monoid)([][]byte{[]byte(""), []byte("a"), []byte("some value")})
}