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:
5
bytes/bytes.go
Normal file
5
bytes/bytes.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package bytes
|
||||
|
||||
func ToString(a []byte) string {
|
||||
return string(a)
|
||||
}
|
19
bytes/monoid.go
Normal file
19
bytes/monoid.go
Normal 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
11
bytes/monoid_test.go
Normal 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")})
|
||||
}
|
Reference in New Issue
Block a user