mirror of
https://github.com/IBM/fp-go.git
synced 2025-06-23 00:27:49 +02:00
doc: fix case
Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
@ -1,12 +1,12 @@
|
|||||||
package array
|
package array
|
||||||
|
|
||||||
import (
|
import (
|
||||||
G "github.com/ibm/fp-go/array/generic"
|
G "github.com/IBM/fp-go/array/generic"
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
"github.com/ibm/fp-go/internal/array"
|
"github.com/IBM/fp-go/internal/array"
|
||||||
M "github.com/ibm/fp-go/monoid"
|
M "github.com/IBM/fp-go/monoid"
|
||||||
O "github.com/ibm/fp-go/option"
|
O "github.com/IBM/fp-go/option"
|
||||||
"github.com/ibm/fp-go/tuple"
|
"github.com/IBM/fp-go/tuple"
|
||||||
)
|
)
|
||||||
|
|
||||||
// From constructs an array from a set of variadic arguments
|
// From constructs an array from a set of variadic arguments
|
||||||
|
@ -4,11 +4,11 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
"github.com/ibm/fp-go/internal/utils"
|
"github.com/IBM/fp-go/internal/utils"
|
||||||
O "github.com/ibm/fp-go/option"
|
O "github.com/IBM/fp-go/option"
|
||||||
S "github.com/ibm/fp-go/string"
|
S "github.com/IBM/fp-go/string"
|
||||||
T "github.com/ibm/fp-go/tuple"
|
T "github.com/IBM/fp-go/tuple"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package array
|
package array
|
||||||
|
|
||||||
import (
|
import (
|
||||||
E "github.com/ibm/fp-go/eq"
|
E "github.com/IBM/fp-go/eq"
|
||||||
)
|
)
|
||||||
|
|
||||||
func equals[T any](left []T, right []T, eq func(T, T) bool) bool {
|
func equals[T any](left []T, right []T, eq func(T, T) bool) bool {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package generic
|
package generic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
"github.com/ibm/fp-go/internal/array"
|
"github.com/IBM/fp-go/internal/array"
|
||||||
O "github.com/ibm/fp-go/option"
|
O "github.com/IBM/fp-go/option"
|
||||||
"github.com/ibm/fp-go/tuple"
|
"github.com/IBM/fp-go/tuple"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Of constructs a single element array
|
// Of constructs a single element array
|
||||||
|
@ -3,7 +3,7 @@ package generic
|
|||||||
import (
|
import (
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
O "github.com/ibm/fp-go/ord"
|
O "github.com/IBM/fp-go/ord"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Sort implements a stable sort on the array given the provided ordering
|
// Sort implements a stable sort on the array given the provided ordering
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package array
|
package array
|
||||||
|
|
||||||
import (
|
import (
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
M "github.com/ibm/fp-go/magma"
|
M "github.com/IBM/fp-go/magma"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ConcatAll[A any](m M.Magma[A]) func(A) func([]A) A {
|
func ConcatAll[A any](m M.Magma[A]) func(A) func([]A) A {
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
M "github.com/ibm/fp-go/magma"
|
M "github.com/IBM/fp-go/magma"
|
||||||
)
|
)
|
||||||
|
|
||||||
var subInt = M.MakeMagma(func(first int, second int) int {
|
var subInt = M.MakeMagma(func(first int, second int) int {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package array
|
package array
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/ibm/fp-go/internal/array"
|
"github.com/IBM/fp-go/internal/array"
|
||||||
M "github.com/ibm/fp-go/monoid"
|
M "github.com/IBM/fp-go/monoid"
|
||||||
)
|
)
|
||||||
|
|
||||||
func concat[T any](left, right []T) []T {
|
func concat[T any](left, right []T) []T {
|
||||||
|
@ -3,7 +3,7 @@ package array
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
M "github.com/ibm/fp-go/monoid/testing"
|
M "github.com/IBM/fp-go/monoid/testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMonoid(t *testing.T) {
|
func TestMonoid(t *testing.T) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package array
|
package array
|
||||||
|
|
||||||
import (
|
import (
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
O "github.com/ibm/fp-go/option"
|
O "github.com/IBM/fp-go/option"
|
||||||
)
|
)
|
||||||
|
|
||||||
// We need to pass the members of the applicative explicitly, because golang does neither support higher kinded types nor template methods on structs or interfaces
|
// We need to pass the members of the applicative explicitly, because golang does neither support higher kinded types nor template methods on structs or interfaces
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
O "github.com/ibm/fp-go/option"
|
O "github.com/IBM/fp-go/option"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSequenceOption(t *testing.T) {
|
func TestSequenceOption(t *testing.T) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package array
|
package array
|
||||||
|
|
||||||
import (
|
import (
|
||||||
G "github.com/ibm/fp-go/array/generic"
|
G "github.com/IBM/fp-go/array/generic"
|
||||||
O "github.com/ibm/fp-go/ord"
|
O "github.com/IBM/fp-go/ord"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Sort implements a stable sort on the array given the provided ordering
|
// Sort implements a stable sort on the array given the provided ordering
|
||||||
|
@ -3,7 +3,7 @@ package array
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
O "github.com/ibm/fp-go/ord"
|
O "github.com/IBM/fp-go/ord"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package array
|
package array
|
||||||
|
|
||||||
import "github.com/ibm/fp-go/internal/array"
|
import "github.com/IBM/fp-go/internal/array"
|
||||||
|
|
||||||
func Traverse[A, B, HKTB, HKTAB, HKTRB any](
|
func Traverse[A, B, HKTB, HKTAB, HKTRB any](
|
||||||
fof func([]B) HKTRB,
|
fof func([]B) HKTRB,
|
||||||
|
@ -3,7 +3,7 @@ package array
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
O "github.com/ibm/fp-go/option"
|
O "github.com/IBM/fp-go/option"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -3,8 +3,8 @@ package bytes
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
||||||
A "github.com/ibm/fp-go/array"
|
A "github.com/IBM/fp-go/array"
|
||||||
O "github.com/ibm/fp-go/ord"
|
O "github.com/IBM/fp-go/ord"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -3,7 +3,7 @@ package bytes
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
M "github.com/ibm/fp-go/monoid/testing"
|
M "github.com/IBM/fp-go/monoid/testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMonoid(t *testing.T) {
|
func TestMonoid(t *testing.T) {
|
||||||
|
@ -380,8 +380,8 @@ func generateApplyHelpers(filename string, count int) error {
|
|||||||
// print out some helpers
|
// print out some helpers
|
||||||
fmt.Fprintf(f, `
|
fmt.Fprintf(f, `
|
||||||
import (
|
import (
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
T "github.com/ibm/fp-go/tuple"
|
T "github.com/IBM/fp-go/tuple"
|
||||||
)
|
)
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
|
||||||
|
|
||||||
C "github.com/urfave/cli/v2"
|
C "github.com/urfave/cli/v2"
|
||||||
)
|
)
|
||||||
@ -84,34 +83,24 @@ func generateContextReaderIOEitherHelpers(filename string, count int) error {
|
|||||||
// log
|
// log
|
||||||
log.Printf("Generating code in [%s] for package [%s] with [%d] repetitions ...", filename, pkg, count)
|
log.Printf("Generating code in [%s] for package [%s] with [%d] repetitions ...", filename, pkg, count)
|
||||||
|
|
||||||
// some header
|
writePackage(f, pkg)
|
||||||
fmt.Fprintln(f, "// Code generated by go generate; DO NOT EDIT.")
|
|
||||||
fmt.Fprintln(f, "// This file was generated by robots at")
|
|
||||||
fmt.Fprintf(f, "// %s\n", time.Now())
|
|
||||||
|
|
||||||
fmt.Fprintf(f, "package %s\n\n", pkg)
|
|
||||||
|
|
||||||
fmt.Fprintf(f, `
|
fmt.Fprintf(f, `
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
G "github.com/ibm/fp-go/context/%s/generic"
|
G "github.com/IBM/fp-go/context/%s/generic"
|
||||||
)
|
)
|
||||||
`, pkg)
|
`, pkg)
|
||||||
|
|
||||||
// some header
|
writePackage(fg, "generic")
|
||||||
fmt.Fprintln(fg, "// Code generated by go generate; DO NOT EDIT.")
|
|
||||||
fmt.Fprintln(fg, "// This file was generated by robots at")
|
|
||||||
fmt.Fprintf(fg, "// %s\n", time.Now())
|
|
||||||
|
|
||||||
fmt.Fprintf(fg, "package generic\n\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(fg, `
|
fmt.Fprintf(fg, `
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
E "github.com/ibm/fp-go/either"
|
E "github.com/IBM/fp-go/either"
|
||||||
RE "github.com/ibm/fp-go/readerioeither/generic"
|
RE "github.com/IBM/fp-go/readerioeither/generic"
|
||||||
)
|
)
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
@ -141,8 +141,8 @@ func generateEitherHelpers(filename string, count int) error {
|
|||||||
|
|
||||||
fmt.Fprintf(f, `
|
fmt.Fprintf(f, `
|
||||||
import (
|
import (
|
||||||
A "github.com/ibm/fp-go/internal/apply"
|
A "github.com/IBM/fp-go/internal/apply"
|
||||||
T "github.com/ibm/fp-go/tuple"
|
T "github.com/IBM/fp-go/tuple"
|
||||||
)
|
)
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
16
cli/header.go
Normal file
16
cli/header.go
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package cli
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func writePackage(f *os.File, pkg string) {
|
||||||
|
// print package
|
||||||
|
fmt.Fprintf(f, "package %s\n\n", pkg)
|
||||||
|
// some header
|
||||||
|
fmt.Fprintln(f, "// Code generated by go generate; DO NOT EDIT.")
|
||||||
|
fmt.Fprintln(f, "// This file was generated by robots at")
|
||||||
|
fmt.Fprintf(f, "// %s\n", time.Now())
|
||||||
|
}
|
@ -53,8 +53,8 @@ func generateIdentityHelpers(filename string, count int) error {
|
|||||||
|
|
||||||
fmt.Fprintf(f, `
|
fmt.Fprintf(f, `
|
||||||
import (
|
import (
|
||||||
A "github.com/ibm/fp-go/internal/apply"
|
A "github.com/IBM/fp-go/internal/apply"
|
||||||
T "github.com/ibm/fp-go/tuple"
|
T "github.com/IBM/fp-go/tuple"
|
||||||
)
|
)
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
@ -139,8 +139,8 @@ func generateOptionHelpers(filename string, count int) error {
|
|||||||
|
|
||||||
fmt.Fprintf(f, `
|
fmt.Fprintf(f, `
|
||||||
import (
|
import (
|
||||||
A "github.com/ibm/fp-go/internal/apply"
|
A "github.com/IBM/fp-go/internal/apply"
|
||||||
T "github.com/ibm/fp-go/tuple"
|
T "github.com/IBM/fp-go/tuple"
|
||||||
)
|
)
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ func generateReaderHelpers(filename string, count int) error {
|
|||||||
|
|
||||||
fmt.Fprintf(f, `
|
fmt.Fprintf(f, `
|
||||||
import (
|
import (
|
||||||
G "github.com/ibm/fp-go/%s/generic"
|
G "github.com/IBM/fp-go/%s/generic"
|
||||||
)
|
)
|
||||||
`, pkg)
|
`, pkg)
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ func generateReaderIOEitherHelpers(filename string, count int) error {
|
|||||||
|
|
||||||
fmt.Fprintf(f, `
|
fmt.Fprintf(f, `
|
||||||
import (
|
import (
|
||||||
G "github.com/ibm/fp-go/%s/generic"
|
G "github.com/IBM/fp-go/%s/generic"
|
||||||
)
|
)
|
||||||
`, pkg)
|
`, pkg)
|
||||||
|
|
||||||
@ -173,8 +173,8 @@ import (
|
|||||||
|
|
||||||
fmt.Fprintf(fg, `
|
fmt.Fprintf(fg, `
|
||||||
import (
|
import (
|
||||||
E "github.com/ibm/fp-go/either"
|
E "github.com/IBM/fp-go/either"
|
||||||
RD "github.com/ibm/fp-go/reader/generic"
|
RD "github.com/IBM/fp-go/reader/generic"
|
||||||
)
|
)
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
@ -346,8 +346,8 @@ func generateTupleHelpers(filename string, count int) error {
|
|||||||
|
|
||||||
fmt.Fprintf(f, `
|
fmt.Fprintf(f, `
|
||||||
import (
|
import (
|
||||||
M "github.com/ibm/fp-go/monoid"
|
M "github.com/IBM/fp-go/monoid"
|
||||||
O "github.com/ibm/fp-go/ord"
|
O "github.com/IBM/fp-go/ord"
|
||||||
)
|
)
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@ package generic
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
E "github.com/ibm/fp-go/either"
|
E "github.com/IBM/fp-go/either"
|
||||||
ET "github.com/ibm/fp-go/either"
|
ET "github.com/IBM/fp-go/either"
|
||||||
IOE "github.com/ibm/fp-go/ioeither/generic"
|
IOE "github.com/IBM/fp-go/ioeither/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// withContext wraps an existing IOEither and performs a context check for cancellation before delegating
|
// withContext wraps an existing IOEither and performs a context check for cancellation before delegating
|
||||||
|
@ -3,8 +3,8 @@ package ioeither
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
G "github.com/ibm/fp-go/context/ioeither/generic"
|
G "github.com/IBM/fp-go/context/ioeither/generic"
|
||||||
IOE "github.com/ibm/fp-go/ioeither"
|
IOE "github.com/IBM/fp-go/ioeither"
|
||||||
)
|
)
|
||||||
|
|
||||||
// withContext wraps an existing IOEither and performs a context check for cancellation before delegating
|
// withContext wraps an existing IOEither and performs a context check for cancellation before delegating
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
package reader
|
package reader
|
||||||
|
|
||||||
import (
|
import (
|
||||||
R "github.com/ibm/fp-go/reader/generic"
|
R "github.com/IBM/fp-go/reader/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TraverseArray transforms an array
|
// TraverseArray transforms an array
|
||||||
|
@ -18,7 +18,7 @@ package reader
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
R "github.com/ibm/fp-go/reader/generic"
|
R "github.com/IBM/fp-go/reader/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// these functions curry a golang function with the context as the firsr parameter into a either reader with the context as the last parameter
|
// these functions curry a golang function with the context as the firsr parameter into a either reader with the context as the last parameter
|
||||||
|
@ -3,7 +3,7 @@ package reader
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
R "github.com/ibm/fp-go/reader/generic"
|
R "github.com/IBM/fp-go/reader/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// these functions curry a golang function with the context as the firsr parameter into a either reader with the context as the last parameter
|
// these functions curry a golang function with the context as the firsr parameter into a either reader with the context as the last parameter
|
||||||
|
@ -3,7 +3,7 @@ package reader
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
R "github.com/ibm/fp-go/reader/generic"
|
R "github.com/IBM/fp-go/reader/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
func MonadMap[A, B any](fa Reader[A], f func(A) B) Reader[B] {
|
func MonadMap[A, B any](fa Reader[A], f func(A) B) Reader[B] {
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
T "github.com/ibm/fp-go/tuple"
|
T "github.com/IBM/fp-go/tuple"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package reader
|
package reader
|
||||||
|
|
||||||
import (
|
import (
|
||||||
R "github.com/ibm/fp-go/reader/generic"
|
R "github.com/IBM/fp-go/reader/generic"
|
||||||
T "github.com/ibm/fp-go/tuple"
|
T "github.com/IBM/fp-go/tuple"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SequenceT converts n inputs of higher kinded types into a higher kinded types of n strongly typed values, represented as a tuple
|
// SequenceT converts n inputs of higher kinded types into a higher kinded types of n strongly typed values, represented as a tuple
|
||||||
|
@ -4,7 +4,7 @@ package reader
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
R "github.com/ibm/fp-go/reader"
|
R "github.com/IBM/fp-go/reader"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Reader is a specialization of the Reader monad assuming a golang context as the context of the monad
|
// Reader is a specialization of the Reader monad assuming a golang context as the context of the monad
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package readereither
|
package readereither
|
||||||
|
|
||||||
import (
|
import (
|
||||||
RE "github.com/ibm/fp-go/readereither/generic"
|
RE "github.com/IBM/fp-go/readereither/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TraverseArray transforms an array
|
// TraverseArray transforms an array
|
||||||
|
@ -3,7 +3,7 @@ package readereither
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
E "github.com/ibm/fp-go/either"
|
E "github.com/IBM/fp-go/either"
|
||||||
)
|
)
|
||||||
|
|
||||||
// withContext wraps an existing ReaderEither and performs a context check for cancellation before deletating
|
// withContext wraps an existing ReaderEither and performs a context check for cancellation before deletating
|
||||||
|
@ -3,7 +3,7 @@ package readereither
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
RE "github.com/ibm/fp-go/readereither/generic"
|
RE "github.com/IBM/fp-go/readereither/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// these functions curry a golang function with the context as the firsr parameter into a either reader with the context as the last parameter
|
// these functions curry a golang function with the context as the firsr parameter into a either reader with the context as the last parameter
|
||||||
|
@ -3,11 +3,11 @@ package exec
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
RE "github.com/ibm/fp-go/context/readereither"
|
RE "github.com/IBM/fp-go/context/readereither"
|
||||||
E "github.com/ibm/fp-go/either"
|
E "github.com/IBM/fp-go/either"
|
||||||
"github.com/ibm/fp-go/exec"
|
"github.com/IBM/fp-go/exec"
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
GE "github.com/ibm/fp-go/internal/exec"
|
GE "github.com/IBM/fp-go/internal/exec"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -3,7 +3,7 @@ package readereither
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
RE "github.com/ibm/fp-go/readereither/generic"
|
RE "github.com/IBM/fp-go/readereither/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// these functions curry a golang function with the context as the firsr parameter into a either reader with the context as the last parameter
|
// these functions curry a golang function with the context as the firsr parameter into a either reader with the context as the last parameter
|
||||||
|
@ -3,10 +3,10 @@ package readereither
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
R "github.com/ibm/fp-go/context/reader"
|
R "github.com/IBM/fp-go/context/reader"
|
||||||
ET "github.com/ibm/fp-go/either"
|
ET "github.com/IBM/fp-go/either"
|
||||||
O "github.com/ibm/fp-go/option"
|
O "github.com/IBM/fp-go/option"
|
||||||
RE "github.com/ibm/fp-go/readereither/generic"
|
RE "github.com/IBM/fp-go/readereither/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
func MakeReaderEither[A any](f func(context.Context) ET.Either[error, A]) ReaderEither[A] {
|
func MakeReaderEither[A any](f func(context.Context) ET.Either[error, A]) ReaderEither[A] {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package readereither
|
package readereither
|
||||||
|
|
||||||
import (
|
import (
|
||||||
RE "github.com/ibm/fp-go/readereither/generic"
|
RE "github.com/IBM/fp-go/readereither/generic"
|
||||||
T "github.com/ibm/fp-go/tuple"
|
T "github.com/IBM/fp-go/tuple"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SequenceT converts n inputs of higher kinded types into a higher kinded types of n strongly typed values, represented as a tuple
|
// SequenceT converts n inputs of higher kinded types into a higher kinded types of n strongly typed values, represented as a tuple
|
||||||
|
@ -4,7 +4,7 @@ package readereither
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
RE "github.com/ibm/fp-go/readereither"
|
RE "github.com/IBM/fp-go/readereither"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ReaderEither is a specialization of the Reader monad for the typical golang scenario
|
// ReaderEither is a specialization of the Reader monad for the typical golang scenario
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package readerio
|
package readerio
|
||||||
|
|
||||||
import (
|
import (
|
||||||
IO "github.com/ibm/fp-go/io"
|
IO "github.com/IBM/fp-go/io"
|
||||||
R "github.com/ibm/fp-go/readerio/generic"
|
R "github.com/IBM/fp-go/readerio/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TraverseArray transforms an array
|
// TraverseArray transforms an array
|
||||||
|
@ -3,8 +3,8 @@ package readerio
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
IO "github.com/ibm/fp-go/io"
|
IO "github.com/IBM/fp-go/io"
|
||||||
R "github.com/ibm/fp-go/readerio/generic"
|
R "github.com/IBM/fp-go/readerio/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// these functions curry a golang function with the context as the firsr parameter into a either reader with the context as the last parameter
|
// these functions curry a golang function with the context as the firsr parameter into a either reader with the context as the last parameter
|
||||||
|
@ -3,7 +3,7 @@ package readerio
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
R "github.com/ibm/fp-go/readerio/generic"
|
R "github.com/IBM/fp-go/readerio/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
func MonadMap[A, B any](fa ReaderIO[A], f func(A) B) ReaderIO[B] {
|
func MonadMap[A, B any](fa ReaderIO[A], f func(A) B) ReaderIO[B] {
|
||||||
|
@ -6,9 +6,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
IO "github.com/ibm/fp-go/io"
|
IO "github.com/IBM/fp-go/io"
|
||||||
T "github.com/ibm/fp-go/tuple"
|
T "github.com/IBM/fp-go/tuple"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package readerio
|
package readerio
|
||||||
|
|
||||||
import (
|
import (
|
||||||
R "github.com/ibm/fp-go/readerio/generic"
|
R "github.com/IBM/fp-go/readerio/generic"
|
||||||
T "github.com/ibm/fp-go/tuple"
|
T "github.com/IBM/fp-go/tuple"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SequenceT converts n inputs of higher kinded types into a higher kinded types of n strongly typed values, represented as a tuple
|
// SequenceT converts n inputs of higher kinded types into a higher kinded types of n strongly typed values, represented as a tuple
|
||||||
|
@ -4,7 +4,7 @@ package readerio
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
R "github.com/ibm/fp-go/readerio"
|
R "github.com/IBM/fp-go/readerio"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ReaderIO is a specialization of the ReaderIO monad assuming a golang context as the context of the monad
|
// ReaderIO is a specialization of the ReaderIO monad assuming a golang context as the context of the monad
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package readerioeither
|
package readerioeither
|
||||||
|
|
||||||
import (
|
import (
|
||||||
G "github.com/ibm/fp-go/context/readerioeither/generic"
|
G "github.com/IBM/fp-go/context/readerioeither/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// WithContext wraps an existing ReaderIOEither and performs a context check for cancellation before delegating
|
// WithContext wraps an existing ReaderIOEither and performs a context check for cancellation before delegating
|
||||||
|
@ -3,9 +3,9 @@ package readerioeither
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
G "github.com/ibm/fp-go/context/readerioeither/generic"
|
G "github.com/IBM/fp-go/context/readerioeither/generic"
|
||||||
ET "github.com/ibm/fp-go/either"
|
ET "github.com/IBM/fp-go/either"
|
||||||
EQ "github.com/ibm/fp-go/eq"
|
EQ "github.com/IBM/fp-go/eq"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Eq implements the equals predicate for values contained in the IOEither monad
|
// Eq implements the equals predicate for values contained in the IOEither monad
|
||||||
|
@ -3,11 +3,11 @@ package exec
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
RIOE "github.com/ibm/fp-go/context/readerioeither"
|
RIOE "github.com/IBM/fp-go/context/readerioeither"
|
||||||
"github.com/ibm/fp-go/exec"
|
"github.com/IBM/fp-go/exec"
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
GE "github.com/ibm/fp-go/internal/exec"
|
GE "github.com/IBM/fp-go/internal/exec"
|
||||||
IOE "github.com/ibm/fp-go/ioeither"
|
IOE "github.com/IBM/fp-go/ioeither"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -5,11 +5,11 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
RIOE "github.com/ibm/fp-go/context/readerioeither"
|
RIOE "github.com/IBM/fp-go/context/readerioeither"
|
||||||
ET "github.com/ibm/fp-go/either"
|
ET "github.com/IBM/fp-go/either"
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
"github.com/ibm/fp-go/internal/file"
|
"github.com/IBM/fp-go/internal/file"
|
||||||
IOE "github.com/ibm/fp-go/ioeither"
|
IOE "github.com/IBM/fp-go/ioeither"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -7,7 +7,7 @@ package readerioeither
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
G "github.com/ibm/fp-go/context/readerioeither/generic"
|
G "github.com/IBM/fp-go/context/readerioeither/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Eitherize0 converts a function with 0 parameters returning a tuple into a function with 0 parameters returning a [ReaderIOEither[R]]
|
// Eitherize0 converts a function with 0 parameters returning a tuple into a function with 0 parameters returning a [ReaderIOEither[R]]
|
||||||
|
@ -3,9 +3,9 @@ package generic
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
CIOE "github.com/ibm/fp-go/context/ioeither/generic"
|
CIOE "github.com/IBM/fp-go/context/ioeither/generic"
|
||||||
E "github.com/ibm/fp-go/either"
|
E "github.com/IBM/fp-go/either"
|
||||||
IOE "github.com/ibm/fp-go/ioeither/generic"
|
IOE "github.com/IBM/fp-go/ioeither/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// withContext wraps an existing ReaderIOEither and performs a context check for cancellation before delegating
|
// withContext wraps an existing ReaderIOEither and performs a context check for cancellation before delegating
|
||||||
|
@ -3,10 +3,10 @@ package generic
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
E "github.com/ibm/fp-go/either"
|
E "github.com/IBM/fp-go/either"
|
||||||
ET "github.com/ibm/fp-go/either"
|
ET "github.com/IBM/fp-go/either"
|
||||||
EQ "github.com/ibm/fp-go/eq"
|
EQ "github.com/IBM/fp-go/eq"
|
||||||
G "github.com/ibm/fp-go/readerioeither/generic"
|
G "github.com/IBM/fp-go/readerioeither/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Eq implements the equals predicate for values contained in the IOEither monad
|
// Eq implements the equals predicate for values contained in the IOEither monad
|
||||||
|
@ -7,8 +7,8 @@ package generic
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
E "github.com/ibm/fp-go/either"
|
E "github.com/IBM/fp-go/either"
|
||||||
RE "github.com/ibm/fp-go/readerioeither/generic"
|
RE "github.com/IBM/fp-go/readerioeither/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Eitherize0 converts a function with 0 parameters returning a tuple into a function with 0 parameters returning a [GRA]
|
// Eitherize0 converts a function with 0 parameters returning a tuple into a function with 0 parameters returning a [GRA]
|
||||||
|
@ -4,13 +4,13 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
E "github.com/ibm/fp-go/either"
|
E "github.com/IBM/fp-go/either"
|
||||||
ER "github.com/ibm/fp-go/errors"
|
ER "github.com/IBM/fp-go/errors"
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
IO "github.com/ibm/fp-go/io/generic"
|
IO "github.com/IBM/fp-go/io/generic"
|
||||||
IOE "github.com/ibm/fp-go/ioeither/generic"
|
IOE "github.com/IBM/fp-go/ioeither/generic"
|
||||||
O "github.com/ibm/fp-go/option"
|
O "github.com/IBM/fp-go/option"
|
||||||
RIE "github.com/ibm/fp-go/readerioeither/generic"
|
RIE "github.com/IBM/fp-go/readerioeither/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
func FromEither[
|
func FromEither[
|
||||||
|
@ -3,9 +3,9 @@ package generic
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
E "github.com/ibm/fp-go/either"
|
E "github.com/IBM/fp-go/either"
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
RIE "github.com/ibm/fp-go/readerioeither/generic"
|
RIE "github.com/IBM/fp-go/readerioeither/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// WithResource constructs a function that creates a resource, then operates on it and then releases the resource
|
// WithResource constructs a function that creates a resource, then operates on it and then releases the resource
|
||||||
|
@ -3,9 +3,9 @@ package generic
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
E "github.com/ibm/fp-go/either"
|
E "github.com/IBM/fp-go/either"
|
||||||
RE "github.com/ibm/fp-go/readerioeither/generic"
|
RE "github.com/IBM/fp-go/readerioeither/generic"
|
||||||
T "github.com/ibm/fp-go/tuple"
|
T "github.com/IBM/fp-go/tuple"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SequenceT converts n inputs of higher kinded types into a higher kinded types of n strongly typed values, represented as a tuple
|
// SequenceT converts n inputs of higher kinded types into a higher kinded types of n strongly typed values, represented as a tuple
|
||||||
|
@ -3,8 +3,8 @@ package generic
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
E "github.com/ibm/fp-go/either"
|
E "github.com/IBM/fp-go/either"
|
||||||
RE "github.com/ibm/fp-go/readerioeither/generic"
|
RE "github.com/IBM/fp-go/readerioeither/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TraverseArray transforms an array
|
// TraverseArray transforms an array
|
||||||
|
@ -4,14 +4,14 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
B "github.com/ibm/fp-go/bytes"
|
B "github.com/IBM/fp-go/bytes"
|
||||||
RIOE "github.com/ibm/fp-go/context/readerioeither"
|
RIOE "github.com/IBM/fp-go/context/readerioeither"
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
H "github.com/ibm/fp-go/http"
|
H "github.com/IBM/fp-go/http"
|
||||||
IOE "github.com/ibm/fp-go/ioeither"
|
IOE "github.com/IBM/fp-go/ioeither"
|
||||||
IOEF "github.com/ibm/fp-go/ioeither/file"
|
IOEF "github.com/IBM/fp-go/ioeither/file"
|
||||||
J "github.com/ibm/fp-go/json"
|
J "github.com/IBM/fp-go/json"
|
||||||
T "github.com/ibm/fp-go/tuple"
|
T "github.com/IBM/fp-go/tuple"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
@ -4,13 +4,13 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
R "github.com/ibm/fp-go/context/reader"
|
R "github.com/IBM/fp-go/context/reader"
|
||||||
RIO "github.com/ibm/fp-go/context/readerio"
|
RIO "github.com/IBM/fp-go/context/readerio"
|
||||||
G "github.com/ibm/fp-go/context/readerioeither/generic"
|
G "github.com/IBM/fp-go/context/readerioeither/generic"
|
||||||
ET "github.com/ibm/fp-go/either"
|
ET "github.com/IBM/fp-go/either"
|
||||||
IO "github.com/ibm/fp-go/io"
|
IO "github.com/IBM/fp-go/io"
|
||||||
IOE "github.com/ibm/fp-go/ioeither"
|
IOE "github.com/IBM/fp-go/ioeither"
|
||||||
O "github.com/ibm/fp-go/option"
|
O "github.com/IBM/fp-go/option"
|
||||||
)
|
)
|
||||||
|
|
||||||
func FromEither[A any](e ET.Either[error, A]) ReaderIOEither[A] {
|
func FromEither[A any](e ET.Either[error, A]) ReaderIOEither[A] {
|
||||||
|
@ -6,9 +6,9 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
E "github.com/ibm/fp-go/either"
|
E "github.com/IBM/fp-go/either"
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
"github.com/ibm/fp-go/internal/utils"
|
"github.com/IBM/fp-go/internal/utils"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package readerioeither
|
package readerioeither
|
||||||
|
|
||||||
import (
|
import (
|
||||||
G "github.com/ibm/fp-go/context/readerioeither/generic"
|
G "github.com/IBM/fp-go/context/readerioeither/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// WithResource constructs a function that creates a resource, then operates on it and then releases the resource
|
// WithResource constructs a function that creates a resource, then operates on it and then releases the resource
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package readerioeither
|
package readerioeither
|
||||||
|
|
||||||
import (
|
import (
|
||||||
G "github.com/ibm/fp-go/context/readerioeither/generic"
|
G "github.com/IBM/fp-go/context/readerioeither/generic"
|
||||||
T "github.com/ibm/fp-go/tuple"
|
T "github.com/IBM/fp-go/tuple"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SequenceT converts n inputs of higher kinded types into a higher kinded types of n strongly typed values, represented as a tuple
|
// SequenceT converts n inputs of higher kinded types into a higher kinded types of n strongly typed values, represented as a tuple
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package readerioeither
|
package readerioeither
|
||||||
|
|
||||||
import (
|
import (
|
||||||
G "github.com/ibm/fp-go/context/readerioeither/generic"
|
G "github.com/IBM/fp-go/context/readerioeither/generic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TraverseArray transforms an array
|
// TraverseArray transforms an array
|
||||||
|
@ -4,7 +4,7 @@ package readerioeither
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
RE "github.com/ibm/fp-go/readerioeither"
|
RE "github.com/IBM/fp-go/readerioeither"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ReaderIOEither is a specialization of the Reader monad for the typical golang scenario
|
// ReaderIOEither is a specialization of the Reader monad for the typical golang scenario
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package either
|
package either
|
||||||
|
|
||||||
import (
|
import (
|
||||||
M "github.com/ibm/fp-go/monoid"
|
M "github.com/IBM/fp-go/monoid"
|
||||||
S "github.com/ibm/fp-go/semigroup"
|
S "github.com/IBM/fp-go/semigroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ApplySemigroup[E, A any](s S.Semigroup[A]) S.Semigroup[Either[E, A]] {
|
func ApplySemigroup[E, A any](s S.Semigroup[A]) S.Semigroup[Either[E, A]] {
|
||||||
|
@ -3,8 +3,8 @@ package either
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
M "github.com/ibm/fp-go/monoid/testing"
|
M "github.com/IBM/fp-go/monoid/testing"
|
||||||
N "github.com/ibm/fp-go/number"
|
N "github.com/IBM/fp-go/number"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package either
|
package either
|
||||||
|
|
||||||
import (
|
import (
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
)
|
)
|
||||||
|
|
||||||
// these function curry a golang function that returns an error into its curried version that returns an either
|
// these function curry a golang function that returns an error into its curried version that returns an either
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
package either
|
package either
|
||||||
|
|
||||||
import (
|
import (
|
||||||
E "github.com/ibm/fp-go/errors"
|
E "github.com/IBM/fp-go/errors"
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
O "github.com/ibm/fp-go/option"
|
O "github.com/IBM/fp-go/option"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Of is equivalent to [Right]
|
// Of is equivalent to [Right]
|
||||||
|
@ -4,10 +4,10 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
"github.com/ibm/fp-go/internal/utils"
|
"github.com/IBM/fp-go/internal/utils"
|
||||||
O "github.com/ibm/fp-go/option"
|
O "github.com/IBM/fp-go/option"
|
||||||
S "github.com/ibm/fp-go/string"
|
S "github.com/IBM/fp-go/string"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package either
|
package either
|
||||||
|
|
||||||
import (
|
import (
|
||||||
EQ "github.com/ibm/fp-go/eq"
|
EQ "github.com/IBM/fp-go/eq"
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Constructs an equal predicate for an `Either`
|
// Constructs an equal predicate for an `Either`
|
||||||
|
@ -3,10 +3,10 @@ package exec
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
E "github.com/ibm/fp-go/either"
|
E "github.com/IBM/fp-go/either"
|
||||||
"github.com/ibm/fp-go/exec"
|
"github.com/IBM/fp-go/exec"
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
GE "github.com/ibm/fp-go/internal/exec"
|
GE "github.com/IBM/fp-go/internal/exec"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -5,8 +5,8 @@ package either
|
|||||||
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
A "github.com/ibm/fp-go/internal/apply"
|
A "github.com/IBM/fp-go/internal/apply"
|
||||||
T "github.com/ibm/fp-go/tuple"
|
T "github.com/IBM/fp-go/tuple"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Eitherize0 converts a function with 0 parameters returning a tuple into a function with 0 parameters returning an Either
|
// Eitherize0 converts a function with 0 parameters returning a tuple into a function with 0 parameters returning an Either
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
E "github.com/ibm/fp-go/either"
|
E "github.com/IBM/fp-go/either"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -3,8 +3,8 @@ package either
|
|||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
L "github.com/ibm/fp-go/logging"
|
L "github.com/IBM/fp-go/logging"
|
||||||
)
|
)
|
||||||
|
|
||||||
func _log[E, A any](left func(string, ...any), right func(string, ...any), prefix string) func(Either[E, A]) Either[E, A] {
|
func _log[E, A any](left func(string, ...any), right func(string, ...any), prefix string) func(Either[E, A]) Either[E, A] {
|
||||||
|
@ -3,7 +3,7 @@ package either
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package either
|
package either
|
||||||
|
|
||||||
import (
|
import (
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
RR "github.com/ibm/fp-go/internal/record"
|
RR "github.com/IBM/fp-go/internal/record"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TraverseRecord transforms a record of options into an option of a record
|
// TraverseRecord transforms a record of options into an option of a record
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package either
|
package either
|
||||||
|
|
||||||
import (
|
import (
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
)
|
)
|
||||||
|
|
||||||
// constructs a function that creates a resource, then operates on it and then releases the resource
|
// constructs a function that creates a resource, then operates on it and then releases the resource
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@ package testing
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
ET "github.com/ibm/fp-go/either"
|
ET "github.com/IBM/fp-go/either"
|
||||||
EQ "github.com/ibm/fp-go/eq"
|
EQ "github.com/IBM/fp-go/eq"
|
||||||
L "github.com/ibm/fp-go/internal/monad/testing"
|
L "github.com/IBM/fp-go/internal/monad/testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AssertLaws asserts the apply monad laws for the `Either` monad
|
// AssertLaws asserts the apply monad laws for the `Either` monad
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
EQ "github.com/ibm/fp-go/eq"
|
EQ "github.com/IBM/fp-go/eq"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package either
|
package either
|
||||||
|
|
||||||
import (
|
import (
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3,8 +3,8 @@ package either
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
O "github.com/ibm/fp-go/option"
|
O "github.com/IBM/fp-go/option"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
2
eq/eq.go
2
eq/eq.go
@ -1,7 +1,7 @@
|
|||||||
package eq
|
package eq
|
||||||
|
|
||||||
import (
|
import (
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Eq[T any] interface {
|
type Eq[T any] interface {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package eq
|
package eq
|
||||||
|
|
||||||
import (
|
import (
|
||||||
M "github.com/ibm/fp-go/monoid"
|
M "github.com/IBM/fp-go/monoid"
|
||||||
S "github.com/ibm/fp-go/semigroup"
|
S "github.com/IBM/fp-go/semigroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Semigroup[A any]() S.Semigroup[Eq[A]] {
|
func Semigroup[A any]() S.Semigroup[Eq[A]] {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package testing
|
package testing
|
||||||
|
|
||||||
import (
|
import (
|
||||||
EQ "github.com/ibm/fp-go/eq"
|
EQ "github.com/IBM/fp-go/eq"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package errors
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
O "github.com/ibm/fp-go/option"
|
O "github.com/IBM/fp-go/option"
|
||||||
)
|
)
|
||||||
|
|
||||||
// As tries to extract the error of desired type from the given error
|
// As tries to extract the error of desired type from the given error
|
||||||
|
@ -4,8 +4,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
O "github.com/ibm/fp-go/option"
|
O "github.com/IBM/fp-go/option"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package errors
|
package errors
|
||||||
|
|
||||||
import (
|
import (
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
)
|
)
|
||||||
|
|
||||||
var IdentityError = F.Identity[error]
|
var IdentityError = F.Identity[error]
|
||||||
|
@ -3,7 +3,7 @@ package errors
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
A "github.com/ibm/fp-go/array"
|
A "github.com/IBM/fp-go/array"
|
||||||
)
|
)
|
||||||
|
|
||||||
// OnNone generates a nullary function that produces a formatted error
|
// OnNone generates a nullary function that produces a formatted error
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package exec
|
package exec
|
||||||
|
|
||||||
import (
|
import (
|
||||||
T "github.com/ibm/fp-go/tuple"
|
T "github.com/IBM/fp-go/tuple"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
2
go.mod
2
go.mod
@ -1,4 +1,4 @@
|
|||||||
module github.com/ibm/fp-go
|
module github.com/IBM/fp-go
|
||||||
|
|
||||||
go 1.20
|
go 1.20
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package http
|
|||||||
import (
|
import (
|
||||||
H "net/http"
|
H "net/http"
|
||||||
|
|
||||||
T "github.com/ibm/fp-go/tuple"
|
T "github.com/IBM/fp-go/tuple"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
@ -7,13 +7,13 @@ import (
|
|||||||
H "net/http"
|
H "net/http"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
A "github.com/ibm/fp-go/array"
|
A "github.com/IBM/fp-go/array"
|
||||||
E "github.com/ibm/fp-go/either"
|
E "github.com/IBM/fp-go/either"
|
||||||
"github.com/ibm/fp-go/errors"
|
"github.com/IBM/fp-go/errors"
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
O "github.com/ibm/fp-go/option"
|
O "github.com/IBM/fp-go/option"
|
||||||
R "github.com/ibm/fp-go/record/generic"
|
R "github.com/IBM/fp-go/record/generic"
|
||||||
T "github.com/ibm/fp-go/tuple"
|
T "github.com/IBM/fp-go/tuple"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
@ -3,8 +3,8 @@ package http
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
E "github.com/ibm/fp-go/either"
|
E "github.com/IBM/fp-go/either"
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ package identity
|
|||||||
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
A "github.com/ibm/fp-go/internal/apply"
|
A "github.com/IBM/fp-go/internal/apply"
|
||||||
T "github.com/ibm/fp-go/tuple"
|
T "github.com/IBM/fp-go/tuple"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SequenceT1 converts 1 parameters of [T] into a [Tuple1].
|
// SequenceT1 converts 1 parameters of [T] into a [Tuple1].
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package generic
|
package generic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
F "github.com/ibm/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
C "github.com/ibm/fp-go/internal/chain"
|
C "github.com/IBM/fp-go/internal/chain"
|
||||||
)
|
)
|
||||||
|
|
||||||
func MonadAp[GAB ~func(A) B, B, A any](fab GAB, fa A) B {
|
func MonadAp[GAB ~func(A) B, B, A any](fab GAB, fa A) B {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user