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

fix: generate sequenceT

Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
Dr. Carsten Leue
2023-07-13 22:24:04 +02:00
parent a18a04ce39
commit 177979354c
23 changed files with 1424 additions and 123 deletions

View File

@@ -1,72 +0,0 @@
package Apply
import (
F "github.com/ibm/fp-go/function"
T "github.com/ibm/fp-go/tuple"
)
func tupleConstructor1[A any]() func(A) T.Tuple1[A] {
return F.Curry1(T.MakeTuple1[A])
}
func tupleConstructor2[A, B any]() func(A) func(B) T.Tuple2[A, B] {
return F.Curry2(T.MakeTuple2[A, B])
}
func tupleConstructor3[A, B, C any]() func(A) func(B) func(C) T.Tuple3[A, B, C] {
return F.Curry3(T.MakeTuple3[A, B, C])
}
func tupleConstructor4[A, B, C, D any]() func(A) func(B) func(C) func(D) T.Tuple4[A, B, C, D] {
return F.Curry4(T.MakeTuple4[A, B, C, D])
}
func SequenceT1[A, HKTA, HKT1A any](
fmap func(HKTA, func(A) T.Tuple1[A]) HKT1A,
a HKTA) HKT1A {
return fmap(a, tupleConstructor1[A]())
}
// HKTA = HKT[A]
// HKTB = HKT[B]
// HKT2AB = HKT[Tuple[A, B]]
// HKTFB2AB = HKT[func(B)Tuple[A, B]]
func SequenceT2[A, B, HKTA, HKTB, HKTFB2AB, HKT2AB any](
fmap func(HKTA, func(A) func(B) T.Tuple2[A, B]) HKTFB2AB,
fap1 func(HKTFB2AB, HKTB) HKT2AB,
a HKTA, b HKTB,
) HKT2AB {
return fap1(fmap(a, tupleConstructor2[A, B]()), b)
}
// HKTA = HKT[A]
// HKTB = HKT[B]
// HKTC = HKT[C]
// HKT3ABC = HKT[Tuple[A, B, C]]
// HKTFB3ABC = HKT[func(B)func(C)Tuple[A, B, C]]
// HKTFC3ABC = HKT[func(C)Tuple[A, B, C]]
func SequenceT3[A, B, C, HKTA, HKTB, HKTC, HKTFB3ABC, HKTFC3ABC, HKT3ABC any](
fmap func(HKTA, func(A) func(B) func(C) T.Tuple3[A, B, C]) HKTFB3ABC,
fap1 func(HKTFB3ABC, HKTB) HKTFC3ABC,
fap2 func(HKTFC3ABC, HKTC) HKT3ABC,
a HKTA, b HKTB, c HKTC) HKT3ABC {
return fap2(fap1(fmap(a, tupleConstructor3[A, B, C]()), b), c)
}
// HKTA = HKT[A]
// HKTB = HKT[B]
// HKTC = HKT[C]
// HKT3ABCD = HKT[Tuple[A, B, C, D]]
// HKTFB3ABCD = HKT[func(B)func(C)func(D)Tuple[A, B, C, D]]
// HKTFC3ABCD = HKT[func(C)func(D)Tuple[A, B, C, D]]
// HKTFD3ABCD = HKT[func(D)Tuple[A, B, C, D]]
func SequenceT4[A, B, C, D, HKTA, HKTB, HKTC, HKTD, HKTFB4ABCD, HKTFC4ABCD, HKTFD4ABCD, HKT4ABCD any](
fmap func(HKTA, func(A) func(B) func(C) func(D) T.Tuple4[A, B, C, D]) HKTFB4ABCD,
fap1 func(HKTFB4ABCD, HKTB) HKTFC4ABCD,
fap2 func(HKTFC4ABCD, HKTC) HKTFD4ABCD,
fap3 func(HKTFD4ABCD, HKTD) HKT4ABCD,
a HKTA, b HKTB, c HKTC, d HKTD) HKT4ABCD {
return fap3(fap2(fap1(fmap(a, tupleConstructor4[A, B, C, D]()), b), c), d)
}

203
cli/apply.go Normal file
View File

@@ -0,0 +1,203 @@
package cli
import (
"fmt"
"log"
"os"
"path/filepath"
"time"
C "github.com/urfave/cli/v2"
)
func generateSequenceT(f *os.File, i int) {
fmt.Fprintf(f, "\n// SequenceT%d is a utility function used to implement the sequence operation for higher kinded types based only on map and ap.\n", i)
fmt.Fprintf(f, "// The function takes %d higher higher kinded types and returns a higher kinded type of a [Tuple%d] with the resolved values.\n", i, i)
fmt.Fprintf(f, "func SequenceT%d[\n", i)
// map as the starting point
fmt.Fprintf(f, " MAP ~func(HKT_T1,")
for j := 0; j < i; j++ {
fmt.Fprintf(f, " func(T%d)", j+1)
}
fmt.Fprintf(f, " ")
fmt.Fprintf(f, "T.")
writeTupleType(f, i)
fmt.Fprintf(f, ")")
if i > 1 {
fmt.Fprintf(f, " HKT_F")
for k := 1; k < i; k++ {
fmt.Fprintf(f, "_T%d", k+1)
}
} else {
fmt.Fprintf(f, " HKT_TUPLE%d", i)
}
fmt.Fprintf(f, ",\n")
// the applicatives
for j := 1; j < i; j++ {
fmt.Fprintf(f, " AP%d ~func(", j)
fmt.Fprintf(f, "HKT_F")
for k := j; k < i; k++ {
fmt.Fprintf(f, "_T%d", k+1)
}
fmt.Fprintf(f, ", HKT_T%d)", j+1)
if j+1 < i {
fmt.Fprintf(f, " HKT_F")
for k := j + 1; k < i; k++ {
fmt.Fprintf(f, "_T%d", k+1)
}
} else {
fmt.Fprintf(f, " HKT_TUPLE%d", i)
}
fmt.Fprintf(f, ",\n")
}
for j := 0; j < i; j++ {
fmt.Fprintf(f, " T%d,\n", j+1)
}
for j := 0; j < i; j++ {
fmt.Fprintf(f, " HKT_T%d, // HKT[T%d]\n", j+1, j+1)
}
for j := 1; j < i; j++ {
fmt.Fprintf(f, " HKT_F")
for k := j; k < i; k++ {
fmt.Fprintf(f, "_T%d", k+1)
}
fmt.Fprintf(f, ", // HKT[")
for k := j; k < i; k++ {
fmt.Fprintf(f, "func(T%d) ", k+1)
}
fmt.Fprintf(f, "T.")
writeTupleType(f, i)
fmt.Fprintf(f, "]\n")
}
fmt.Fprintf(f, " HKT_TUPLE%d any, // HKT[", i)
writeTupleType(f, i)
fmt.Fprintf(f, "]\n")
fmt.Fprintf(f, "](\n")
// the callbacks
fmt.Fprintf(f, " fmap MAP,\n")
for j := 1; j < i; j++ {
fmt.Fprintf(f, " fap%d AP%d,\n", j, j)
}
// the parameters
for j := 0; j < i; j++ {
fmt.Fprintf(f, " t%d HKT_T%d,\n", j+1, j+1)
}
fmt.Fprintf(f, ") HKT_TUPLE%d {\n", i)
fmt.Fprintf(f, " return ")
for j := i - 1; j >= 1; j-- {
fmt.Fprintf(f, "fap%d(", j)
}
fmt.Fprintf(f, "fmap(t1, tupleConstructor%d[", i)
for j := 0; j < i; j++ {
if j > 0 {
fmt.Fprintf(f, ", ")
}
fmt.Fprintf(f, "T%d", j+1)
}
fmt.Fprintf(f, "]())")
for j := 1; j < i; j++ {
fmt.Fprintf(f, ", t%d)", j+1)
}
fmt.Fprintf(f, "\n")
fmt.Fprintf(f, "}\n")
}
func generateTupleConstructor(f *os.File, i int) {
// Create the optionize version
fmt.Fprintf(f, "\n// tupleConstructor%d returns a curried version of [T.MakeTuple%d]\n", i, i)
fmt.Fprintf(f, "func tupleConstructor%d[", i)
for j := 0; j < i; j++ {
if j > 0 {
fmt.Fprintf(f, ", ")
}
fmt.Fprintf(f, "T%d", j+1)
}
fmt.Fprintf(f, " any]()")
for j := 0; j < i; j++ {
fmt.Fprintf(f, " func(T%d)", j+1)
}
fmt.Fprintf(f, " T.Tuple%d[", i)
for j := 0; j < i; j++ {
if j > 0 {
fmt.Fprintf(f, ", ")
}
fmt.Fprintf(f, "T%d", j+1)
}
fmt.Fprintf(f, "] {\n")
fmt.Fprintf(f, " return F.Curry%d(T.MakeTuple%d[", i, i)
for j := 0; j < i; j++ {
if j > 0 {
fmt.Fprintf(f, ", ")
}
fmt.Fprintf(f, "T%d", j+1)
}
fmt.Fprintf(f, "])\n")
fmt.Fprintf(f, "}\n")
}
func generateApplyHelpers(filename string, count int) error {
dir, err := os.Getwd()
if err != nil {
return err
}
absDir, err := filepath.Abs(dir)
if err != nil {
return err
}
pkg := filepath.Base(absDir)
f, err := os.Create(filepath.Clean(filename))
if err != nil {
return err
}
defer f.Close()
// log
log.Printf("Generating code in [%s] for package [%s] with [%d] repetitions ...", filename, pkg, count)
// 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())
fmt.Fprintf(f, "package %s\n\n", pkg)
// print out some helpers
fmt.Fprintf(f, `
import (
F "github.com/ibm/fp-go/function"
T "github.com/ibm/fp-go/tuple"
)
`)
for i := 1; i <= count; i++ {
// tuple constructor
generateTupleConstructor(f, i)
// sequenceT
generateSequenceT(f, i)
}
return nil
}
func ApplyCommand() *C.Command {
return &C.Command{
Name: "apply",
Usage: "generate code for the sequence operations of apply",
Flags: []C.Flag{
flagCount,
flagFilename,
},
Action: func(ctx *C.Context) error {
return generateApplyHelpers(
ctx.String(keyFilename),
ctx.Int(keyCount),
)
},
}
}

279
cli/bind.go Normal file
View File

@@ -0,0 +1,279 @@
package cli
import (
"fmt"
"log"
"os"
"path/filepath"
"time"
C "github.com/urfave/cli/v2"
)
func createCombinations(n int, all, prev []int) [][]int {
l := len(prev)
if l == n {
return [][]int{prev}
}
var res [][]int
for idx, val := range all {
cpy := make([]int, l+1)
copy(cpy, prev)
cpy[l] = val
res = append(res, createCombinations(n, all[idx+1:], cpy)...)
}
return res
}
func remaining(comb []int, total int) []int {
var res []int
mp := make(map[int]int)
for _, idx := range comb {
mp[idx] = idx
}
for i := 1; i <= total; i++ {
_, ok := mp[i]
if !ok {
res = append(res, i)
}
}
return res
}
func generateCombSingleBind(f *os.File, comb [][]int, total int) {
for _, c := range comb {
// remaining indexes
rem := remaining(c, total)
// bind function
fmt.Fprintf(f, "\n// Bind")
for _, idx := range c {
fmt.Fprintf(f, "%d", idx)
}
fmt.Fprintf(f, "of%d takes a function with %d parameters and returns a new function with %d parameters that will bind these parameters to the positions [", total, total, len(c))
for i, idx := range c {
if i > 0 {
fmt.Fprintf(f, ", ")
}
fmt.Fprintf(f, "%d", idx)
}
fmt.Fprintf(f, "] of the original function.\n// The return value of is a function with the remaining %d parameters at positions [", len(rem))
for i, idx := range rem {
if i > 0 {
fmt.Fprintf(f, ", ")
}
fmt.Fprintf(f, "%d", idx)
}
fmt.Fprintf(f, "] of the original function.\n")
fmt.Fprintf(f, "func Bind")
for _, idx := range c {
fmt.Fprintf(f, "%d", idx)
}
fmt.Fprintf(f, "of%d[F ~func(", total)
for i := 0; i < total; i++ {
if i > 0 {
fmt.Fprintf(f, ", ")
}
fmt.Fprintf(f, "T%d", i+1)
}
fmt.Fprintf(f, ") R")
for i := 0; i < total; i++ {
fmt.Fprintf(f, ", T%d", i+1)
}
fmt.Fprintf(f, ", R any](f F) func(")
for i, idx := range c {
if i > 0 {
fmt.Fprintf(f, ", ")
}
fmt.Fprintf(f, "T%d", idx)
}
fmt.Fprintf(f, ") func(")
for i, idx := range rem {
if i > 0 {
fmt.Fprintf(f, ", ")
}
fmt.Fprintf(f, "T%d", idx)
}
fmt.Fprintf(f, ") R {\n")
fmt.Fprintf(f, " return func(")
for i, idx := range c {
if i > 0 {
fmt.Fprintf(f, ", ")
}
fmt.Fprintf(f, "t%d T%d", idx, idx)
}
fmt.Fprintf(f, ") func(")
for i, idx := range rem {
if i > 0 {
fmt.Fprintf(f, ", ")
}
fmt.Fprintf(f, "T%d", idx)
}
fmt.Fprintf(f, ") R {\n")
fmt.Fprintf(f, " return func(")
for i, idx := range rem {
if i > 0 {
fmt.Fprintf(f, ", ")
}
fmt.Fprintf(f, "t%d T%d", idx, idx)
}
fmt.Fprintf(f, ") R {\n")
fmt.Fprintf(f, " return f(")
for i := 1; i <= total; i++ {
if i > 1 {
fmt.Fprintf(f, ", ")
}
fmt.Fprintf(f, "t%d", i)
}
fmt.Fprintf(f, ")\n")
fmt.Fprintf(f, " }\n")
fmt.Fprintf(f, " }\n")
fmt.Fprintf(f, "}\n")
// ignore function
fmt.Fprintf(f, "\n// Ignore")
for _, idx := range c {
fmt.Fprintf(f, "%d", idx)
}
fmt.Fprintf(f, "of%d takes a function with %d parameters and returns a new function with %d parameters that will ignore the values at positions [", total, len(rem), total)
for i, idx := range c {
if i > 0 {
fmt.Fprintf(f, ", ")
}
fmt.Fprintf(f, "%d", idx)
}
fmt.Fprintf(f, "] and pass the remaining %d parameters to the original function\n", len(rem))
fmt.Fprintf(f, "func Ignore")
for _, idx := range c {
fmt.Fprintf(f, "%d", idx)
}
fmt.Fprintf(f, "of%d[", total)
// start with the undefined parameters
for i, idx := range c {
if i > 0 {
fmt.Fprintf(f, ", ")
}
fmt.Fprintf(f, "T%d", idx)
}
if len(c) > 0 {
fmt.Fprintf(f, " any, ")
}
fmt.Fprintf(f, "F ~func(")
for i, idx := range rem {
if i > 0 {
fmt.Fprintf(f, ", ")
}
fmt.Fprintf(f, "T%d", idx)
}
fmt.Fprintf(f, ") R")
for _, idx := range rem {
fmt.Fprintf(f, ", T%d", idx)
}
fmt.Fprintf(f, ", R any](f F) func(")
for i := 0; i < total; i++ {
if i > 0 {
fmt.Fprintf(f, ", ")
}
fmt.Fprintf(f, "T%d", i+1)
}
fmt.Fprintf(f, ") R {\n")
fmt.Fprintf(f, " return func(")
for i := 0; i < total; i++ {
if i > 0 {
fmt.Fprintf(f, ", ")
}
fmt.Fprintf(f, "t%d T%d", i+1, i+1)
}
fmt.Fprintf(f, ") R {\n")
fmt.Fprintf(f, " return f(")
for i, idx := range rem {
if i > 0 {
fmt.Fprintf(f, ", ")
}
fmt.Fprintf(f, "t%d", idx)
}
fmt.Fprintf(f, ")\n")
fmt.Fprintf(f, " }\n")
fmt.Fprintf(f, "}\n")
}
}
func generateSingleBind(f *os.File, total int) {
fmt.Fprintf(f, "// Combinations for a total of %d arguments\n", total)
// construct the indexes
all := make([]int, total)
for i := 0; i < total; i++ {
all[i] = i + 1
}
// for all permutations of a certain length
for j := 0; j < total; j++ {
// get combinations of that size
comb := createCombinations(j+1, all, []int{})
generateCombSingleBind(f, comb, total)
}
}
func generateBind(f *os.File, i int) {
for j := 1; j < i; j++ {
generateSingleBind(f, j)
}
}
func generateBindHelpers(filename string, count int) error {
dir, err := os.Getwd()
if err != nil {
return err
}
absDir, err := filepath.Abs(dir)
if err != nil {
return err
}
pkg := filepath.Base(absDir)
f, err := os.Create(filepath.Clean(filename))
if err != nil {
return err
}
defer f.Close()
// log
log.Printf("Generating code in [%s] for package [%s] with [%d] repetitions ...", filename, pkg, count)
// 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())
fmt.Fprintf(f, "package %s\n", pkg)
generateBind(f, count)
return nil
}
func BindCommand() *C.Command {
return &C.Command{
Name: "bind",
Usage: "generate code for binder functions etc",
Description: "Code generation for bind, etc",
Flags: []C.Flag{
flagCount,
flagFilename,
},
Action: func(ctx *C.Context) error {
return generateBindHelpers(
ctx.String(keyFilename),
ctx.Int(keyCount),
)
},
}
}

View File

@@ -10,5 +10,7 @@ func Commands() []*C.Command {
OptionCommand(),
EitherCommand(),
TupleCommand(),
BindCommand(),
ApplyCommand(),
}
}

View File

@@ -106,7 +106,7 @@ func generateEitherHelpers(filename string, count int) error {
return err
}
pkg := filepath.Base(absDir)
f, err := os.Create(filename)
f, err := os.Create(filepath.Clean(filename))
if err != nil {
return err
}

View File

@@ -106,7 +106,7 @@ func generateOptionHelpers(filename string, count int) error {
return err
}
pkg := filepath.Base(absDir)
f, err := os.Create(filename)
f, err := os.Create(filepath.Clean(filename))
if err != nil {
return err
}

View File

@@ -311,7 +311,7 @@ func generatePipeHelpers(filename string, count int) error {
return err
}
pkg := filepath.Base(absDir)
f, err := os.Create(filename)
f, err := os.Create(filepath.Clean(filename))
if err != nil {
return err
}

View File

@@ -262,7 +262,7 @@ func generateTupleHelpers(filename string, count int) error {
return err
}
pkg := filepath.Base(absDir)
f, err := os.Create(filename)
f, err := os.Create(filepath.Clean(filename))
if err != nil {
return err
}

View File

@@ -131,7 +131,7 @@ func FromOption[E, A any](onNone func() E) func(O.Option[A]) Either[E, A] {
}
func ToOption[E, A any]() func(Either[E, A]) O.Option[A] {
return Fold(F.Ignore1[E](O.None[A]), O.Some[A])
return Fold(F.Ignore1of1[E](O.None[A]), O.Some[A])
}
func FromError[A any](f func(a A) error) func(A) Either[error, A] {
@@ -182,7 +182,7 @@ func Reduce[E, A, B any](f func(B, A) B, initial B) func(Either[E, A]) B {
}
func AltW[E, E1, A any](that func() Either[E1, A]) func(Either[E, A]) Either[E1, A] {
return Fold(F.Ignore1[E](that), Right[E1, A])
return Fold(F.Ignore1of1[E](that), Right[E1, A])
}
func Alt[E, A any](that func() Either[E, A]) func(Either[E, A]) Either[E, A] {

View File

@@ -1,6 +1,6 @@
// Code generated by go generate; DO NOT EDIT.
// This file was generated by robots at
// 2023-07-13 17:33:41.4844284 +0200 CEST m=+0.009082001
// 2023-07-13 22:20:17.8012235 +0200 CEST m=+0.012514201
package either

View File

@@ -1,7 +1,7 @@
package either
import (
Apply "github.com/ibm/fp-go/apply"
Apply "github.com/ibm/fp-go/internal/apply"
T "github.com/ibm/fp-go/tuple"
)

View File

@@ -11,42 +11,6 @@ func Bind2nd[T1, T2, R any](f func(T1, T2) R, t2 T2) func(T1) R {
}
}
func Bind1[T1, R any](f func(T1) R, t1 T1) func() R {
return func() R {
return f(t1)
}
}
func Bind2[T1, T2, R any](f func(T1, T2) R, t1 T1, t2 T2) func() R {
return func() R {
return f(t1, t2)
}
}
func Bind3[T1, T2, T3, R any](f func(T1, T2, T3) R, t1 T1, t2 T2, t3 T3) func() R {
return func() R {
return f(t1, t2, t3)
}
}
func SK[T1, T2 any](_ T1, t2 T2) T2 {
return t2
}
func Ignore1[T, R any](f func() R) func(T) R {
return func(_ T) R {
return f()
}
}
func Ignore1st[T1, T2, R any](f func(T2) R) func(T1, T2) R {
return func(_ T1, t2 T2) R {
return f(t2)
}
}
func Ignore2nd[T1, T2, R any](f func(T1) R) func(T1, T2) R {
return func(t1 T1, _ T2) R {
return f(t1)
}
}

450
function/binds.go Normal file
View File

@@ -0,0 +1,450 @@
// Code generated by go generate; DO NOT EDIT.
// This file was generated by robots at
// 2023-07-13 22:20:22.6778 +0200 CEST m=+0.027037401
package function
// Combinations for a total of 1 arguments
// Bind1of1 takes a function with 1 parameters and returns a new function with 1 parameters that will bind these parameters to the positions [1] of the original function.
// The return value of is a function with the remaining 0 parameters at positions [] of the original function.
func Bind1of1[F ~func(T1) R, T1, R any](f F) func(T1) func() R {
return func(t1 T1) func() R {
return func() R {
return f(t1)
}
}
}
// Ignore1of1 takes a function with 0 parameters and returns a new function with 1 parameters that will ignore the values at positions [1] and pass the remaining 0 parameters to the original function
func Ignore1of1[T1 any, F ~func() R, R any](f F) func(T1) R {
return func(t1 T1) R {
return f()
}
}
// Combinations for a total of 2 arguments
// Bind1of2 takes a function with 2 parameters and returns a new function with 1 parameters that will bind these parameters to the positions [1] of the original function.
// The return value of is a function with the remaining 1 parameters at positions [2] of the original function.
func Bind1of2[F ~func(T1, T2) R, T1, T2, R any](f F) func(T1) func(T2) R {
return func(t1 T1) func(T2) R {
return func(t2 T2) R {
return f(t1, t2)
}
}
}
// Ignore1of2 takes a function with 1 parameters and returns a new function with 2 parameters that will ignore the values at positions [1] and pass the remaining 1 parameters to the original function
func Ignore1of2[T1 any, F ~func(T2) R, T2, R any](f F) func(T1, T2) R {
return func(t1 T1, t2 T2) R {
return f(t2)
}
}
// Bind2of2 takes a function with 2 parameters and returns a new function with 1 parameters that will bind these parameters to the positions [2] of the original function.
// The return value of is a function with the remaining 1 parameters at positions [1] of the original function.
func Bind2of2[F ~func(T1, T2) R, T1, T2, R any](f F) func(T2) func(T1) R {
return func(t2 T2) func(T1) R {
return func(t1 T1) R {
return f(t1, t2)
}
}
}
// Ignore2of2 takes a function with 1 parameters and returns a new function with 2 parameters that will ignore the values at positions [2] and pass the remaining 1 parameters to the original function
func Ignore2of2[T2 any, F ~func(T1) R, T1, R any](f F) func(T1, T2) R {
return func(t1 T1, t2 T2) R {
return f(t1)
}
}
// Bind12of2 takes a function with 2 parameters and returns a new function with 2 parameters that will bind these parameters to the positions [1, 2] of the original function.
// The return value of is a function with the remaining 0 parameters at positions [] of the original function.
func Bind12of2[F ~func(T1, T2) R, T1, T2, R any](f F) func(T1, T2) func() R {
return func(t1 T1, t2 T2) func() R {
return func() R {
return f(t1, t2)
}
}
}
// Ignore12of2 takes a function with 0 parameters and returns a new function with 2 parameters that will ignore the values at positions [1, 2] and pass the remaining 0 parameters to the original function
func Ignore12of2[T1, T2 any, F ~func() R, R any](f F) func(T1, T2) R {
return func(t1 T1, t2 T2) R {
return f()
}
}
// Combinations for a total of 3 arguments
// Bind1of3 takes a function with 3 parameters and returns a new function with 1 parameters that will bind these parameters to the positions [1] of the original function.
// The return value of is a function with the remaining 2 parameters at positions [2, 3] of the original function.
func Bind1of3[F ~func(T1, T2, T3) R, T1, T2, T3, R any](f F) func(T1) func(T2, T3) R {
return func(t1 T1) func(T2, T3) R {
return func(t2 T2, t3 T3) R {
return f(t1, t2, t3)
}
}
}
// Ignore1of3 takes a function with 2 parameters and returns a new function with 3 parameters that will ignore the values at positions [1] and pass the remaining 2 parameters to the original function
func Ignore1of3[T1 any, F ~func(T2, T3) R, T2, T3, R any](f F) func(T1, T2, T3) R {
return func(t1 T1, t2 T2, t3 T3) R {
return f(t2, t3)
}
}
// Bind2of3 takes a function with 3 parameters and returns a new function with 1 parameters that will bind these parameters to the positions [2] of the original function.
// The return value of is a function with the remaining 2 parameters at positions [1, 3] of the original function.
func Bind2of3[F ~func(T1, T2, T3) R, T1, T2, T3, R any](f F) func(T2) func(T1, T3) R {
return func(t2 T2) func(T1, T3) R {
return func(t1 T1, t3 T3) R {
return f(t1, t2, t3)
}
}
}
// Ignore2of3 takes a function with 2 parameters and returns a new function with 3 parameters that will ignore the values at positions [2] and pass the remaining 2 parameters to the original function
func Ignore2of3[T2 any, F ~func(T1, T3) R, T1, T3, R any](f F) func(T1, T2, T3) R {
return func(t1 T1, t2 T2, t3 T3) R {
return f(t1, t3)
}
}
// Bind3of3 takes a function with 3 parameters and returns a new function with 1 parameters that will bind these parameters to the positions [3] of the original function.
// The return value of is a function with the remaining 2 parameters at positions [1, 2] of the original function.
func Bind3of3[F ~func(T1, T2, T3) R, T1, T2, T3, R any](f F) func(T3) func(T1, T2) R {
return func(t3 T3) func(T1, T2) R {
return func(t1 T1, t2 T2) R {
return f(t1, t2, t3)
}
}
}
// Ignore3of3 takes a function with 2 parameters and returns a new function with 3 parameters that will ignore the values at positions [3] and pass the remaining 2 parameters to the original function
func Ignore3of3[T3 any, F ~func(T1, T2) R, T1, T2, R any](f F) func(T1, T2, T3) R {
return func(t1 T1, t2 T2, t3 T3) R {
return f(t1, t2)
}
}
// Bind12of3 takes a function with 3 parameters and returns a new function with 2 parameters that will bind these parameters to the positions [1, 2] of the original function.
// The return value of is a function with the remaining 1 parameters at positions [3] of the original function.
func Bind12of3[F ~func(T1, T2, T3) R, T1, T2, T3, R any](f F) func(T1, T2) func(T3) R {
return func(t1 T1, t2 T2) func(T3) R {
return func(t3 T3) R {
return f(t1, t2, t3)
}
}
}
// Ignore12of3 takes a function with 1 parameters and returns a new function with 3 parameters that will ignore the values at positions [1, 2] and pass the remaining 1 parameters to the original function
func Ignore12of3[T1, T2 any, F ~func(T3) R, T3, R any](f F) func(T1, T2, T3) R {
return func(t1 T1, t2 T2, t3 T3) R {
return f(t3)
}
}
// Bind13of3 takes a function with 3 parameters and returns a new function with 2 parameters that will bind these parameters to the positions [1, 3] of the original function.
// The return value of is a function with the remaining 1 parameters at positions [2] of the original function.
func Bind13of3[F ~func(T1, T2, T3) R, T1, T2, T3, R any](f F) func(T1, T3) func(T2) R {
return func(t1 T1, t3 T3) func(T2) R {
return func(t2 T2) R {
return f(t1, t2, t3)
}
}
}
// Ignore13of3 takes a function with 1 parameters and returns a new function with 3 parameters that will ignore the values at positions [1, 3] and pass the remaining 1 parameters to the original function
func Ignore13of3[T1, T3 any, F ~func(T2) R, T2, R any](f F) func(T1, T2, T3) R {
return func(t1 T1, t2 T2, t3 T3) R {
return f(t2)
}
}
// Bind23of3 takes a function with 3 parameters and returns a new function with 2 parameters that will bind these parameters to the positions [2, 3] of the original function.
// The return value of is a function with the remaining 1 parameters at positions [1] of the original function.
func Bind23of3[F ~func(T1, T2, T3) R, T1, T2, T3, R any](f F) func(T2, T3) func(T1) R {
return func(t2 T2, t3 T3) func(T1) R {
return func(t1 T1) R {
return f(t1, t2, t3)
}
}
}
// Ignore23of3 takes a function with 1 parameters and returns a new function with 3 parameters that will ignore the values at positions [2, 3] and pass the remaining 1 parameters to the original function
func Ignore23of3[T2, T3 any, F ~func(T1) R, T1, R any](f F) func(T1, T2, T3) R {
return func(t1 T1, t2 T2, t3 T3) R {
return f(t1)
}
}
// Bind123of3 takes a function with 3 parameters and returns a new function with 3 parameters that will bind these parameters to the positions [1, 2, 3] of the original function.
// The return value of is a function with the remaining 0 parameters at positions [] of the original function.
func Bind123of3[F ~func(T1, T2, T3) R, T1, T2, T3, R any](f F) func(T1, T2, T3) func() R {
return func(t1 T1, t2 T2, t3 T3) func() R {
return func() R {
return f(t1, t2, t3)
}
}
}
// Ignore123of3 takes a function with 0 parameters and returns a new function with 3 parameters that will ignore the values at positions [1, 2, 3] and pass the remaining 0 parameters to the original function
func Ignore123of3[T1, T2, T3 any, F ~func() R, R any](f F) func(T1, T2, T3) R {
return func(t1 T1, t2 T2, t3 T3) R {
return f()
}
}
// Combinations for a total of 4 arguments
// Bind1of4 takes a function with 4 parameters and returns a new function with 1 parameters that will bind these parameters to the positions [1] of the original function.
// The return value of is a function with the remaining 3 parameters at positions [2, 3, 4] of the original function.
func Bind1of4[F ~func(T1, T2, T3, T4) R, T1, T2, T3, T4, R any](f F) func(T1) func(T2, T3, T4) R {
return func(t1 T1) func(T2, T3, T4) R {
return func(t2 T2, t3 T3, t4 T4) R {
return f(t1, t2, t3, t4)
}
}
}
// Ignore1of4 takes a function with 3 parameters and returns a new function with 4 parameters that will ignore the values at positions [1] and pass the remaining 3 parameters to the original function
func Ignore1of4[T1 any, F ~func(T2, T3, T4) R, T2, T3, T4, R any](f F) func(T1, T2, T3, T4) R {
return func(t1 T1, t2 T2, t3 T3, t4 T4) R {
return f(t2, t3, t4)
}
}
// Bind2of4 takes a function with 4 parameters and returns a new function with 1 parameters that will bind these parameters to the positions [2] of the original function.
// The return value of is a function with the remaining 3 parameters at positions [1, 3, 4] of the original function.
func Bind2of4[F ~func(T1, T2, T3, T4) R, T1, T2, T3, T4, R any](f F) func(T2) func(T1, T3, T4) R {
return func(t2 T2) func(T1, T3, T4) R {
return func(t1 T1, t3 T3, t4 T4) R {
return f(t1, t2, t3, t4)
}
}
}
// Ignore2of4 takes a function with 3 parameters and returns a new function with 4 parameters that will ignore the values at positions [2] and pass the remaining 3 parameters to the original function
func Ignore2of4[T2 any, F ~func(T1, T3, T4) R, T1, T3, T4, R any](f F) func(T1, T2, T3, T4) R {
return func(t1 T1, t2 T2, t3 T3, t4 T4) R {
return f(t1, t3, t4)
}
}
// Bind3of4 takes a function with 4 parameters and returns a new function with 1 parameters that will bind these parameters to the positions [3] of the original function.
// The return value of is a function with the remaining 3 parameters at positions [1, 2, 4] of the original function.
func Bind3of4[F ~func(T1, T2, T3, T4) R, T1, T2, T3, T4, R any](f F) func(T3) func(T1, T2, T4) R {
return func(t3 T3) func(T1, T2, T4) R {
return func(t1 T1, t2 T2, t4 T4) R {
return f(t1, t2, t3, t4)
}
}
}
// Ignore3of4 takes a function with 3 parameters and returns a new function with 4 parameters that will ignore the values at positions [3] and pass the remaining 3 parameters to the original function
func Ignore3of4[T3 any, F ~func(T1, T2, T4) R, T1, T2, T4, R any](f F) func(T1, T2, T3, T4) R {
return func(t1 T1, t2 T2, t3 T3, t4 T4) R {
return f(t1, t2, t4)
}
}
// Bind4of4 takes a function with 4 parameters and returns a new function with 1 parameters that will bind these parameters to the positions [4] of the original function.
// The return value of is a function with the remaining 3 parameters at positions [1, 2, 3] of the original function.
func Bind4of4[F ~func(T1, T2, T3, T4) R, T1, T2, T3, T4, R any](f F) func(T4) func(T1, T2, T3) R {
return func(t4 T4) func(T1, T2, T3) R {
return func(t1 T1, t2 T2, t3 T3) R {
return f(t1, t2, t3, t4)
}
}
}
// Ignore4of4 takes a function with 3 parameters and returns a new function with 4 parameters that will ignore the values at positions [4] and pass the remaining 3 parameters to the original function
func Ignore4of4[T4 any, F ~func(T1, T2, T3) R, T1, T2, T3, R any](f F) func(T1, T2, T3, T4) R {
return func(t1 T1, t2 T2, t3 T3, t4 T4) R {
return f(t1, t2, t3)
}
}
// Bind12of4 takes a function with 4 parameters and returns a new function with 2 parameters that will bind these parameters to the positions [1, 2] of the original function.
// The return value of is a function with the remaining 2 parameters at positions [3, 4] of the original function.
func Bind12of4[F ~func(T1, T2, T3, T4) R, T1, T2, T3, T4, R any](f F) func(T1, T2) func(T3, T4) R {
return func(t1 T1, t2 T2) func(T3, T4) R {
return func(t3 T3, t4 T4) R {
return f(t1, t2, t3, t4)
}
}
}
// Ignore12of4 takes a function with 2 parameters and returns a new function with 4 parameters that will ignore the values at positions [1, 2] and pass the remaining 2 parameters to the original function
func Ignore12of4[T1, T2 any, F ~func(T3, T4) R, T3, T4, R any](f F) func(T1, T2, T3, T4) R {
return func(t1 T1, t2 T2, t3 T3, t4 T4) R {
return f(t3, t4)
}
}
// Bind13of4 takes a function with 4 parameters and returns a new function with 2 parameters that will bind these parameters to the positions [1, 3] of the original function.
// The return value of is a function with the remaining 2 parameters at positions [2, 4] of the original function.
func Bind13of4[F ~func(T1, T2, T3, T4) R, T1, T2, T3, T4, R any](f F) func(T1, T3) func(T2, T4) R {
return func(t1 T1, t3 T3) func(T2, T4) R {
return func(t2 T2, t4 T4) R {
return f(t1, t2, t3, t4)
}
}
}
// Ignore13of4 takes a function with 2 parameters and returns a new function with 4 parameters that will ignore the values at positions [1, 3] and pass the remaining 2 parameters to the original function
func Ignore13of4[T1, T3 any, F ~func(T2, T4) R, T2, T4, R any](f F) func(T1, T2, T3, T4) R {
return func(t1 T1, t2 T2, t3 T3, t4 T4) R {
return f(t2, t4)
}
}
// Bind14of4 takes a function with 4 parameters and returns a new function with 2 parameters that will bind these parameters to the positions [1, 4] of the original function.
// The return value of is a function with the remaining 2 parameters at positions [2, 3] of the original function.
func Bind14of4[F ~func(T1, T2, T3, T4) R, T1, T2, T3, T4, R any](f F) func(T1, T4) func(T2, T3) R {
return func(t1 T1, t4 T4) func(T2, T3) R {
return func(t2 T2, t3 T3) R {
return f(t1, t2, t3, t4)
}
}
}
// Ignore14of4 takes a function with 2 parameters and returns a new function with 4 parameters that will ignore the values at positions [1, 4] and pass the remaining 2 parameters to the original function
func Ignore14of4[T1, T4 any, F ~func(T2, T3) R, T2, T3, R any](f F) func(T1, T2, T3, T4) R {
return func(t1 T1, t2 T2, t3 T3, t4 T4) R {
return f(t2, t3)
}
}
// Bind23of4 takes a function with 4 parameters and returns a new function with 2 parameters that will bind these parameters to the positions [2, 3] of the original function.
// The return value of is a function with the remaining 2 parameters at positions [1, 4] of the original function.
func Bind23of4[F ~func(T1, T2, T3, T4) R, T1, T2, T3, T4, R any](f F) func(T2, T3) func(T1, T4) R {
return func(t2 T2, t3 T3) func(T1, T4) R {
return func(t1 T1, t4 T4) R {
return f(t1, t2, t3, t4)
}
}
}
// Ignore23of4 takes a function with 2 parameters and returns a new function with 4 parameters that will ignore the values at positions [2, 3] and pass the remaining 2 parameters to the original function
func Ignore23of4[T2, T3 any, F ~func(T1, T4) R, T1, T4, R any](f F) func(T1, T2, T3, T4) R {
return func(t1 T1, t2 T2, t3 T3, t4 T4) R {
return f(t1, t4)
}
}
// Bind24of4 takes a function with 4 parameters and returns a new function with 2 parameters that will bind these parameters to the positions [2, 4] of the original function.
// The return value of is a function with the remaining 2 parameters at positions [1, 3] of the original function.
func Bind24of4[F ~func(T1, T2, T3, T4) R, T1, T2, T3, T4, R any](f F) func(T2, T4) func(T1, T3) R {
return func(t2 T2, t4 T4) func(T1, T3) R {
return func(t1 T1, t3 T3) R {
return f(t1, t2, t3, t4)
}
}
}
// Ignore24of4 takes a function with 2 parameters and returns a new function with 4 parameters that will ignore the values at positions [2, 4] and pass the remaining 2 parameters to the original function
func Ignore24of4[T2, T4 any, F ~func(T1, T3) R, T1, T3, R any](f F) func(T1, T2, T3, T4) R {
return func(t1 T1, t2 T2, t3 T3, t4 T4) R {
return f(t1, t3)
}
}
// Bind34of4 takes a function with 4 parameters and returns a new function with 2 parameters that will bind these parameters to the positions [3, 4] of the original function.
// The return value of is a function with the remaining 2 parameters at positions [1, 2] of the original function.
func Bind34of4[F ~func(T1, T2, T3, T4) R, T1, T2, T3, T4, R any](f F) func(T3, T4) func(T1, T2) R {
return func(t3 T3, t4 T4) func(T1, T2) R {
return func(t1 T1, t2 T2) R {
return f(t1, t2, t3, t4)
}
}
}
// Ignore34of4 takes a function with 2 parameters and returns a new function with 4 parameters that will ignore the values at positions [3, 4] and pass the remaining 2 parameters to the original function
func Ignore34of4[T3, T4 any, F ~func(T1, T2) R, T1, T2, R any](f F) func(T1, T2, T3, T4) R {
return func(t1 T1, t2 T2, t3 T3, t4 T4) R {
return f(t1, t2)
}
}
// Bind123of4 takes a function with 4 parameters and returns a new function with 3 parameters that will bind these parameters to the positions [1, 2, 3] of the original function.
// The return value of is a function with the remaining 1 parameters at positions [4] of the original function.
func Bind123of4[F ~func(T1, T2, T3, T4) R, T1, T2, T3, T4, R any](f F) func(T1, T2, T3) func(T4) R {
return func(t1 T1, t2 T2, t3 T3) func(T4) R {
return func(t4 T4) R {
return f(t1, t2, t3, t4)
}
}
}
// Ignore123of4 takes a function with 1 parameters and returns a new function with 4 parameters that will ignore the values at positions [1, 2, 3] and pass the remaining 1 parameters to the original function
func Ignore123of4[T1, T2, T3 any, F ~func(T4) R, T4, R any](f F) func(T1, T2, T3, T4) R {
return func(t1 T1, t2 T2, t3 T3, t4 T4) R {
return f(t4)
}
}
// Bind124of4 takes a function with 4 parameters and returns a new function with 3 parameters that will bind these parameters to the positions [1, 2, 4] of the original function.
// The return value of is a function with the remaining 1 parameters at positions [3] of the original function.
func Bind124of4[F ~func(T1, T2, T3, T4) R, T1, T2, T3, T4, R any](f F) func(T1, T2, T4) func(T3) R {
return func(t1 T1, t2 T2, t4 T4) func(T3) R {
return func(t3 T3) R {
return f(t1, t2, t3, t4)
}
}
}
// Ignore124of4 takes a function with 1 parameters and returns a new function with 4 parameters that will ignore the values at positions [1, 2, 4] and pass the remaining 1 parameters to the original function
func Ignore124of4[T1, T2, T4 any, F ~func(T3) R, T3, R any](f F) func(T1, T2, T3, T4) R {
return func(t1 T1, t2 T2, t3 T3, t4 T4) R {
return f(t3)
}
}
// Bind134of4 takes a function with 4 parameters and returns a new function with 3 parameters that will bind these parameters to the positions [1, 3, 4] of the original function.
// The return value of is a function with the remaining 1 parameters at positions [2] of the original function.
func Bind134of4[F ~func(T1, T2, T3, T4) R, T1, T2, T3, T4, R any](f F) func(T1, T3, T4) func(T2) R {
return func(t1 T1, t3 T3, t4 T4) func(T2) R {
return func(t2 T2) R {
return f(t1, t2, t3, t4)
}
}
}
// Ignore134of4 takes a function with 1 parameters and returns a new function with 4 parameters that will ignore the values at positions [1, 3, 4] and pass the remaining 1 parameters to the original function
func Ignore134of4[T1, T3, T4 any, F ~func(T2) R, T2, R any](f F) func(T1, T2, T3, T4) R {
return func(t1 T1, t2 T2, t3 T3, t4 T4) R {
return f(t2)
}
}
// Bind234of4 takes a function with 4 parameters and returns a new function with 3 parameters that will bind these parameters to the positions [2, 3, 4] of the original function.
// The return value of is a function with the remaining 1 parameters at positions [1] of the original function.
func Bind234of4[F ~func(T1, T2, T3, T4) R, T1, T2, T3, T4, R any](f F) func(T2, T3, T4) func(T1) R {
return func(t2 T2, t3 T3, t4 T4) func(T1) R {
return func(t1 T1) R {
return f(t1, t2, t3, t4)
}
}
}
// Ignore234of4 takes a function with 1 parameters and returns a new function with 4 parameters that will ignore the values at positions [2, 3, 4] and pass the remaining 1 parameters to the original function
func Ignore234of4[T2, T3, T4 any, F ~func(T1) R, T1, R any](f F) func(T1, T2, T3, T4) R {
return func(t1 T1, t2 T2, t3 T3, t4 T4) R {
return f(t1)
}
}
// Bind1234of4 takes a function with 4 parameters and returns a new function with 4 parameters that will bind these parameters to the positions [1, 2, 3, 4] of the original function.
// The return value of is a function with the remaining 0 parameters at positions [] of the original function.
func Bind1234of4[F ~func(T1, T2, T3, T4) R, T1, T2, T3, T4, R any](f F) func(T1, T2, T3, T4) func() R {
return func(t1 T1, t2 T2, t3 T3, t4 T4) func() R {
return func() R {
return f(t1, t2, t3, t4)
}
}
}
// Ignore1234of4 takes a function with 0 parameters and returns a new function with 4 parameters that will ignore the values at positions [1, 2, 3, 4] and pass the remaining 0 parameters to the original function
func Ignore1234of4[T1, T2, T3, T4 any, F ~func() R, R any](f F) func(T1, T2, T3, T4) R {
return func(t1 T1, t2 T2, t3 T3, t4 T4) R {
return f()
}
}

View File

@@ -1,3 +1,5 @@
package function
//go:generate go run .. pipe --count 20 --filename gen.go
//go:generate go run .. bind --count 5 --filename binds.go

View File

@@ -1,6 +1,6 @@
// Code generated by go generate; DO NOT EDIT.
// This file was generated by robots at
// 2023-07-13 17:33:43.0032761 +0200 CEST m=+0.009251401
// 2023-07-13 22:20:19.9258272 +0200 CEST m=+0.046352501
package function
// Pipe0 takes an initial value t0 and successively applies 0 functions where the input of a function is the return value of the previous function

View File

@@ -1,4 +1,4 @@
package Apply
package apply
import (
F "github.com/ibm/fp-go/function"

3
internal/apply/doc.go Normal file
View File

@@ -0,0 +1,3 @@
package apply
//go:generate go run ../.. apply --count 10 --filename gen.go

470
internal/apply/gen.go Normal file
View File

@@ -0,0 +1,470 @@
// Code generated by go generate; DO NOT EDIT.
// This file was generated by robots at
// 2023-07-13 22:20:24.7376009 +0200 CEST m=+0.056113801
package apply
import (
F "github.com/ibm/fp-go/function"
T "github.com/ibm/fp-go/tuple"
)
// tupleConstructor1 returns a curried version of [T.MakeTuple1]
func tupleConstructor1[T1 any]() func(T1) T.Tuple1[T1] {
return F.Curry1(T.MakeTuple1[T1])
}
// SequenceT1 is a utility function used to implement the sequence operation for higher kinded types based only on map and ap.
// The function takes 1 higher higher kinded types and returns a higher kinded type of a [Tuple1] with the resolved values.
func SequenceT1[
MAP ~func(HKT_T1, func(T1) T.Tuple1[T1]) HKT_TUPLE1,
T1,
HKT_T1, // HKT[T1]
HKT_TUPLE1 any, // HKT[Tuple1[T1]]
](
fmap MAP,
t1 HKT_T1,
) HKT_TUPLE1 {
return fmap(t1, tupleConstructor1[T1]())
}
// tupleConstructor2 returns a curried version of [T.MakeTuple2]
func tupleConstructor2[T1, T2 any]() func(T1) func(T2) T.Tuple2[T1, T2] {
return F.Curry2(T.MakeTuple2[T1, T2])
}
// SequenceT2 is a utility function used to implement the sequence operation for higher kinded types based only on map and ap.
// The function takes 2 higher higher kinded types and returns a higher kinded type of a [Tuple2] with the resolved values.
func SequenceT2[
MAP ~func(HKT_T1, func(T1) func(T2) T.Tuple2[T1, T2]) HKT_F_T2,
AP1 ~func(HKT_F_T2, HKT_T2) HKT_TUPLE2,
T1,
T2,
HKT_T1, // HKT[T1]
HKT_T2, // HKT[T2]
HKT_F_T2, // HKT[func(T2) T.Tuple2[T1, T2]]
HKT_TUPLE2 any, // HKT[Tuple2[T1, T2]]
](
fmap MAP,
fap1 AP1,
t1 HKT_T1,
t2 HKT_T2,
) HKT_TUPLE2 {
return fap1(fmap(t1, tupleConstructor2[T1, T2]()), t2)
}
// tupleConstructor3 returns a curried version of [T.MakeTuple3]
func tupleConstructor3[T1, T2, T3 any]() func(T1) func(T2) func(T3) T.Tuple3[T1, T2, T3] {
return F.Curry3(T.MakeTuple3[T1, T2, T3])
}
// SequenceT3 is a utility function used to implement the sequence operation for higher kinded types based only on map and ap.
// The function takes 3 higher higher kinded types and returns a higher kinded type of a [Tuple3] with the resolved values.
func SequenceT3[
MAP ~func(HKT_T1, func(T1) func(T2) func(T3) T.Tuple3[T1, T2, T3]) HKT_F_T2_T3,
AP1 ~func(HKT_F_T2_T3, HKT_T2) HKT_F_T3,
AP2 ~func(HKT_F_T3, HKT_T3) HKT_TUPLE3,
T1,
T2,
T3,
HKT_T1, // HKT[T1]
HKT_T2, // HKT[T2]
HKT_T3, // HKT[T3]
HKT_F_T2_T3, // HKT[func(T2) func(T3) T.Tuple3[T1, T2, T3]]
HKT_F_T3, // HKT[func(T3) T.Tuple3[T1, T2, T3]]
HKT_TUPLE3 any, // HKT[Tuple3[T1, T2, T3]]
](
fmap MAP,
fap1 AP1,
fap2 AP2,
t1 HKT_T1,
t2 HKT_T2,
t3 HKT_T3,
) HKT_TUPLE3 {
return fap2(fap1(fmap(t1, tupleConstructor3[T1, T2, T3]()), t2), t3)
}
// tupleConstructor4 returns a curried version of [T.MakeTuple4]
func tupleConstructor4[T1, T2, T3, T4 any]() func(T1) func(T2) func(T3) func(T4) T.Tuple4[T1, T2, T3, T4] {
return F.Curry4(T.MakeTuple4[T1, T2, T3, T4])
}
// SequenceT4 is a utility function used to implement the sequence operation for higher kinded types based only on map and ap.
// The function takes 4 higher higher kinded types and returns a higher kinded type of a [Tuple4] with the resolved values.
func SequenceT4[
MAP ~func(HKT_T1, func(T1) func(T2) func(T3) func(T4) T.Tuple4[T1, T2, T3, T4]) HKT_F_T2_T3_T4,
AP1 ~func(HKT_F_T2_T3_T4, HKT_T2) HKT_F_T3_T4,
AP2 ~func(HKT_F_T3_T4, HKT_T3) HKT_F_T4,
AP3 ~func(HKT_F_T4, HKT_T4) HKT_TUPLE4,
T1,
T2,
T3,
T4,
HKT_T1, // HKT[T1]
HKT_T2, // HKT[T2]
HKT_T3, // HKT[T3]
HKT_T4, // HKT[T4]
HKT_F_T2_T3_T4, // HKT[func(T2) func(T3) func(T4) T.Tuple4[T1, T2, T3, T4]]
HKT_F_T3_T4, // HKT[func(T3) func(T4) T.Tuple4[T1, T2, T3, T4]]
HKT_F_T4, // HKT[func(T4) T.Tuple4[T1, T2, T3, T4]]
HKT_TUPLE4 any, // HKT[Tuple4[T1, T2, T3, T4]]
](
fmap MAP,
fap1 AP1,
fap2 AP2,
fap3 AP3,
t1 HKT_T1,
t2 HKT_T2,
t3 HKT_T3,
t4 HKT_T4,
) HKT_TUPLE4 {
return fap3(fap2(fap1(fmap(t1, tupleConstructor4[T1, T2, T3, T4]()), t2), t3), t4)
}
// tupleConstructor5 returns a curried version of [T.MakeTuple5]
func tupleConstructor5[T1, T2, T3, T4, T5 any]() func(T1) func(T2) func(T3) func(T4) func(T5) T.Tuple5[T1, T2, T3, T4, T5] {
return F.Curry5(T.MakeTuple5[T1, T2, T3, T4, T5])
}
// SequenceT5 is a utility function used to implement the sequence operation for higher kinded types based only on map and ap.
// The function takes 5 higher higher kinded types and returns a higher kinded type of a [Tuple5] with the resolved values.
func SequenceT5[
MAP ~func(HKT_T1, func(T1) func(T2) func(T3) func(T4) func(T5) T.Tuple5[T1, T2, T3, T4, T5]) HKT_F_T2_T3_T4_T5,
AP1 ~func(HKT_F_T2_T3_T4_T5, HKT_T2) HKT_F_T3_T4_T5,
AP2 ~func(HKT_F_T3_T4_T5, HKT_T3) HKT_F_T4_T5,
AP3 ~func(HKT_F_T4_T5, HKT_T4) HKT_F_T5,
AP4 ~func(HKT_F_T5, HKT_T5) HKT_TUPLE5,
T1,
T2,
T3,
T4,
T5,
HKT_T1, // HKT[T1]
HKT_T2, // HKT[T2]
HKT_T3, // HKT[T3]
HKT_T4, // HKT[T4]
HKT_T5, // HKT[T5]
HKT_F_T2_T3_T4_T5, // HKT[func(T2) func(T3) func(T4) func(T5) T.Tuple5[T1, T2, T3, T4, T5]]
HKT_F_T3_T4_T5, // HKT[func(T3) func(T4) func(T5) T.Tuple5[T1, T2, T3, T4, T5]]
HKT_F_T4_T5, // HKT[func(T4) func(T5) T.Tuple5[T1, T2, T3, T4, T5]]
HKT_F_T5, // HKT[func(T5) T.Tuple5[T1, T2, T3, T4, T5]]
HKT_TUPLE5 any, // HKT[Tuple5[T1, T2, T3, T4, T5]]
](
fmap MAP,
fap1 AP1,
fap2 AP2,
fap3 AP3,
fap4 AP4,
t1 HKT_T1,
t2 HKT_T2,
t3 HKT_T3,
t4 HKT_T4,
t5 HKT_T5,
) HKT_TUPLE5 {
return fap4(fap3(fap2(fap1(fmap(t1, tupleConstructor5[T1, T2, T3, T4, T5]()), t2), t3), t4), t5)
}
// tupleConstructor6 returns a curried version of [T.MakeTuple6]
func tupleConstructor6[T1, T2, T3, T4, T5, T6 any]() func(T1) func(T2) func(T3) func(T4) func(T5) func(T6) T.Tuple6[T1, T2, T3, T4, T5, T6] {
return F.Curry6(T.MakeTuple6[T1, T2, T3, T4, T5, T6])
}
// SequenceT6 is a utility function used to implement the sequence operation for higher kinded types based only on map and ap.
// The function takes 6 higher higher kinded types and returns a higher kinded type of a [Tuple6] with the resolved values.
func SequenceT6[
MAP ~func(HKT_T1, func(T1) func(T2) func(T3) func(T4) func(T5) func(T6) T.Tuple6[T1, T2, T3, T4, T5, T6]) HKT_F_T2_T3_T4_T5_T6,
AP1 ~func(HKT_F_T2_T3_T4_T5_T6, HKT_T2) HKT_F_T3_T4_T5_T6,
AP2 ~func(HKT_F_T3_T4_T5_T6, HKT_T3) HKT_F_T4_T5_T6,
AP3 ~func(HKT_F_T4_T5_T6, HKT_T4) HKT_F_T5_T6,
AP4 ~func(HKT_F_T5_T6, HKT_T5) HKT_F_T6,
AP5 ~func(HKT_F_T6, HKT_T6) HKT_TUPLE6,
T1,
T2,
T3,
T4,
T5,
T6,
HKT_T1, // HKT[T1]
HKT_T2, // HKT[T2]
HKT_T3, // HKT[T3]
HKT_T4, // HKT[T4]
HKT_T5, // HKT[T5]
HKT_T6, // HKT[T6]
HKT_F_T2_T3_T4_T5_T6, // HKT[func(T2) func(T3) func(T4) func(T5) func(T6) T.Tuple6[T1, T2, T3, T4, T5, T6]]
HKT_F_T3_T4_T5_T6, // HKT[func(T3) func(T4) func(T5) func(T6) T.Tuple6[T1, T2, T3, T4, T5, T6]]
HKT_F_T4_T5_T6, // HKT[func(T4) func(T5) func(T6) T.Tuple6[T1, T2, T3, T4, T5, T6]]
HKT_F_T5_T6, // HKT[func(T5) func(T6) T.Tuple6[T1, T2, T3, T4, T5, T6]]
HKT_F_T6, // HKT[func(T6) T.Tuple6[T1, T2, T3, T4, T5, T6]]
HKT_TUPLE6 any, // HKT[Tuple6[T1, T2, T3, T4, T5, T6]]
](
fmap MAP,
fap1 AP1,
fap2 AP2,
fap3 AP3,
fap4 AP4,
fap5 AP5,
t1 HKT_T1,
t2 HKT_T2,
t3 HKT_T3,
t4 HKT_T4,
t5 HKT_T5,
t6 HKT_T6,
) HKT_TUPLE6 {
return fap5(fap4(fap3(fap2(fap1(fmap(t1, tupleConstructor6[T1, T2, T3, T4, T5, T6]()), t2), t3), t4), t5), t6)
}
// tupleConstructor7 returns a curried version of [T.MakeTuple7]
func tupleConstructor7[T1, T2, T3, T4, T5, T6, T7 any]() func(T1) func(T2) func(T3) func(T4) func(T5) func(T6) func(T7) T.Tuple7[T1, T2, T3, T4, T5, T6, T7] {
return F.Curry7(T.MakeTuple7[T1, T2, T3, T4, T5, T6, T7])
}
// SequenceT7 is a utility function used to implement the sequence operation for higher kinded types based only on map and ap.
// The function takes 7 higher higher kinded types and returns a higher kinded type of a [Tuple7] with the resolved values.
func SequenceT7[
MAP ~func(HKT_T1, func(T1) func(T2) func(T3) func(T4) func(T5) func(T6) func(T7) T.Tuple7[T1, T2, T3, T4, T5, T6, T7]) HKT_F_T2_T3_T4_T5_T6_T7,
AP1 ~func(HKT_F_T2_T3_T4_T5_T6_T7, HKT_T2) HKT_F_T3_T4_T5_T6_T7,
AP2 ~func(HKT_F_T3_T4_T5_T6_T7, HKT_T3) HKT_F_T4_T5_T6_T7,
AP3 ~func(HKT_F_T4_T5_T6_T7, HKT_T4) HKT_F_T5_T6_T7,
AP4 ~func(HKT_F_T5_T6_T7, HKT_T5) HKT_F_T6_T7,
AP5 ~func(HKT_F_T6_T7, HKT_T6) HKT_F_T7,
AP6 ~func(HKT_F_T7, HKT_T7) HKT_TUPLE7,
T1,
T2,
T3,
T4,
T5,
T6,
T7,
HKT_T1, // HKT[T1]
HKT_T2, // HKT[T2]
HKT_T3, // HKT[T3]
HKT_T4, // HKT[T4]
HKT_T5, // HKT[T5]
HKT_T6, // HKT[T6]
HKT_T7, // HKT[T7]
HKT_F_T2_T3_T4_T5_T6_T7, // HKT[func(T2) func(T3) func(T4) func(T5) func(T6) func(T7) T.Tuple7[T1, T2, T3, T4, T5, T6, T7]]
HKT_F_T3_T4_T5_T6_T7, // HKT[func(T3) func(T4) func(T5) func(T6) func(T7) T.Tuple7[T1, T2, T3, T4, T5, T6, T7]]
HKT_F_T4_T5_T6_T7, // HKT[func(T4) func(T5) func(T6) func(T7) T.Tuple7[T1, T2, T3, T4, T5, T6, T7]]
HKT_F_T5_T6_T7, // HKT[func(T5) func(T6) func(T7) T.Tuple7[T1, T2, T3, T4, T5, T6, T7]]
HKT_F_T6_T7, // HKT[func(T6) func(T7) T.Tuple7[T1, T2, T3, T4, T5, T6, T7]]
HKT_F_T7, // HKT[func(T7) T.Tuple7[T1, T2, T3, T4, T5, T6, T7]]
HKT_TUPLE7 any, // HKT[Tuple7[T1, T2, T3, T4, T5, T6, T7]]
](
fmap MAP,
fap1 AP1,
fap2 AP2,
fap3 AP3,
fap4 AP4,
fap5 AP5,
fap6 AP6,
t1 HKT_T1,
t2 HKT_T2,
t3 HKT_T3,
t4 HKT_T4,
t5 HKT_T5,
t6 HKT_T6,
t7 HKT_T7,
) HKT_TUPLE7 {
return fap6(fap5(fap4(fap3(fap2(fap1(fmap(t1, tupleConstructor7[T1, T2, T3, T4, T5, T6, T7]()), t2), t3), t4), t5), t6), t7)
}
// tupleConstructor8 returns a curried version of [T.MakeTuple8]
func tupleConstructor8[T1, T2, T3, T4, T5, T6, T7, T8 any]() func(T1) func(T2) func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8] {
return F.Curry8(T.MakeTuple8[T1, T2, T3, T4, T5, T6, T7, T8])
}
// SequenceT8 is a utility function used to implement the sequence operation for higher kinded types based only on map and ap.
// The function takes 8 higher higher kinded types and returns a higher kinded type of a [Tuple8] with the resolved values.
func SequenceT8[
MAP ~func(HKT_T1, func(T1) func(T2) func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]) HKT_F_T2_T3_T4_T5_T6_T7_T8,
AP1 ~func(HKT_F_T2_T3_T4_T5_T6_T7_T8, HKT_T2) HKT_F_T3_T4_T5_T6_T7_T8,
AP2 ~func(HKT_F_T3_T4_T5_T6_T7_T8, HKT_T3) HKT_F_T4_T5_T6_T7_T8,
AP3 ~func(HKT_F_T4_T5_T6_T7_T8, HKT_T4) HKT_F_T5_T6_T7_T8,
AP4 ~func(HKT_F_T5_T6_T7_T8, HKT_T5) HKT_F_T6_T7_T8,
AP5 ~func(HKT_F_T6_T7_T8, HKT_T6) HKT_F_T7_T8,
AP6 ~func(HKT_F_T7_T8, HKT_T7) HKT_F_T8,
AP7 ~func(HKT_F_T8, HKT_T8) HKT_TUPLE8,
T1,
T2,
T3,
T4,
T5,
T6,
T7,
T8,
HKT_T1, // HKT[T1]
HKT_T2, // HKT[T2]
HKT_T3, // HKT[T3]
HKT_T4, // HKT[T4]
HKT_T5, // HKT[T5]
HKT_T6, // HKT[T6]
HKT_T7, // HKT[T7]
HKT_T8, // HKT[T8]
HKT_F_T2_T3_T4_T5_T6_T7_T8, // HKT[func(T2) func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]]
HKT_F_T3_T4_T5_T6_T7_T8, // HKT[func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]]
HKT_F_T4_T5_T6_T7_T8, // HKT[func(T4) func(T5) func(T6) func(T7) func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]]
HKT_F_T5_T6_T7_T8, // HKT[func(T5) func(T6) func(T7) func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]]
HKT_F_T6_T7_T8, // HKT[func(T6) func(T7) func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]]
HKT_F_T7_T8, // HKT[func(T7) func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]]
HKT_F_T8, // HKT[func(T8) T.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]]
HKT_TUPLE8 any, // HKT[Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]]
](
fmap MAP,
fap1 AP1,
fap2 AP2,
fap3 AP3,
fap4 AP4,
fap5 AP5,
fap6 AP6,
fap7 AP7,
t1 HKT_T1,
t2 HKT_T2,
t3 HKT_T3,
t4 HKT_T4,
t5 HKT_T5,
t6 HKT_T6,
t7 HKT_T7,
t8 HKT_T8,
) HKT_TUPLE8 {
return fap7(fap6(fap5(fap4(fap3(fap2(fap1(fmap(t1, tupleConstructor8[T1, T2, T3, T4, T5, T6, T7, T8]()), t2), t3), t4), t5), t6), t7), t8)
}
// tupleConstructor9 returns a curried version of [T.MakeTuple9]
func tupleConstructor9[T1, T2, T3, T4, T5, T6, T7, T8, T9 any]() func(T1) func(T2) func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9] {
return F.Curry9(T.MakeTuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9])
}
// SequenceT9 is a utility function used to implement the sequence operation for higher kinded types based only on map and ap.
// The function takes 9 higher higher kinded types and returns a higher kinded type of a [Tuple9] with the resolved values.
func SequenceT9[
MAP ~func(HKT_T1, func(T1) func(T2) func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]) HKT_F_T2_T3_T4_T5_T6_T7_T8_T9,
AP1 ~func(HKT_F_T2_T3_T4_T5_T6_T7_T8_T9, HKT_T2) HKT_F_T3_T4_T5_T6_T7_T8_T9,
AP2 ~func(HKT_F_T3_T4_T5_T6_T7_T8_T9, HKT_T3) HKT_F_T4_T5_T6_T7_T8_T9,
AP3 ~func(HKT_F_T4_T5_T6_T7_T8_T9, HKT_T4) HKT_F_T5_T6_T7_T8_T9,
AP4 ~func(HKT_F_T5_T6_T7_T8_T9, HKT_T5) HKT_F_T6_T7_T8_T9,
AP5 ~func(HKT_F_T6_T7_T8_T9, HKT_T6) HKT_F_T7_T8_T9,
AP6 ~func(HKT_F_T7_T8_T9, HKT_T7) HKT_F_T8_T9,
AP7 ~func(HKT_F_T8_T9, HKT_T8) HKT_F_T9,
AP8 ~func(HKT_F_T9, HKT_T9) HKT_TUPLE9,
T1,
T2,
T3,
T4,
T5,
T6,
T7,
T8,
T9,
HKT_T1, // HKT[T1]
HKT_T2, // HKT[T2]
HKT_T3, // HKT[T3]
HKT_T4, // HKT[T4]
HKT_T5, // HKT[T5]
HKT_T6, // HKT[T6]
HKT_T7, // HKT[T7]
HKT_T8, // HKT[T8]
HKT_T9, // HKT[T9]
HKT_F_T2_T3_T4_T5_T6_T7_T8_T9, // HKT[func(T2) func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]]
HKT_F_T3_T4_T5_T6_T7_T8_T9, // HKT[func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]]
HKT_F_T4_T5_T6_T7_T8_T9, // HKT[func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]]
HKT_F_T5_T6_T7_T8_T9, // HKT[func(T5) func(T6) func(T7) func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]]
HKT_F_T6_T7_T8_T9, // HKT[func(T6) func(T7) func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]]
HKT_F_T7_T8_T9, // HKT[func(T7) func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]]
HKT_F_T8_T9, // HKT[func(T8) func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]]
HKT_F_T9, // HKT[func(T9) T.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]]
HKT_TUPLE9 any, // HKT[Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]]
](
fmap MAP,
fap1 AP1,
fap2 AP2,
fap3 AP3,
fap4 AP4,
fap5 AP5,
fap6 AP6,
fap7 AP7,
fap8 AP8,
t1 HKT_T1,
t2 HKT_T2,
t3 HKT_T3,
t4 HKT_T4,
t5 HKT_T5,
t6 HKT_T6,
t7 HKT_T7,
t8 HKT_T8,
t9 HKT_T9,
) HKT_TUPLE9 {
return fap8(fap7(fap6(fap5(fap4(fap3(fap2(fap1(fmap(t1, tupleConstructor9[T1, T2, T3, T4, T5, T6, T7, T8, T9]()), t2), t3), t4), t5), t6), t7), t8), t9)
}
// tupleConstructor10 returns a curried version of [T.MakeTuple10]
func tupleConstructor10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 any]() func(T1) func(T2) func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10] {
return F.Curry10(T.MakeTuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10])
}
// SequenceT10 is a utility function used to implement the sequence operation for higher kinded types based only on map and ap.
// The function takes 10 higher higher kinded types and returns a higher kinded type of a [Tuple10] with the resolved values.
func SequenceT10[
MAP ~func(HKT_T1, func(T1) func(T2) func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]) HKT_F_T2_T3_T4_T5_T6_T7_T8_T9_T10,
AP1 ~func(HKT_F_T2_T3_T4_T5_T6_T7_T8_T9_T10, HKT_T2) HKT_F_T3_T4_T5_T6_T7_T8_T9_T10,
AP2 ~func(HKT_F_T3_T4_T5_T6_T7_T8_T9_T10, HKT_T3) HKT_F_T4_T5_T6_T7_T8_T9_T10,
AP3 ~func(HKT_F_T4_T5_T6_T7_T8_T9_T10, HKT_T4) HKT_F_T5_T6_T7_T8_T9_T10,
AP4 ~func(HKT_F_T5_T6_T7_T8_T9_T10, HKT_T5) HKT_F_T6_T7_T8_T9_T10,
AP5 ~func(HKT_F_T6_T7_T8_T9_T10, HKT_T6) HKT_F_T7_T8_T9_T10,
AP6 ~func(HKT_F_T7_T8_T9_T10, HKT_T7) HKT_F_T8_T9_T10,
AP7 ~func(HKT_F_T8_T9_T10, HKT_T8) HKT_F_T9_T10,
AP8 ~func(HKT_F_T9_T10, HKT_T9) HKT_F_T10,
AP9 ~func(HKT_F_T10, HKT_T10) HKT_TUPLE10,
T1,
T2,
T3,
T4,
T5,
T6,
T7,
T8,
T9,
T10,
HKT_T1, // HKT[T1]
HKT_T2, // HKT[T2]
HKT_T3, // HKT[T3]
HKT_T4, // HKT[T4]
HKT_T5, // HKT[T5]
HKT_T6, // HKT[T6]
HKT_T7, // HKT[T7]
HKT_T8, // HKT[T8]
HKT_T9, // HKT[T9]
HKT_T10, // HKT[T10]
HKT_F_T2_T3_T4_T5_T6_T7_T8_T9_T10, // HKT[func(T2) func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]]
HKT_F_T3_T4_T5_T6_T7_T8_T9_T10, // HKT[func(T3) func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]]
HKT_F_T4_T5_T6_T7_T8_T9_T10, // HKT[func(T4) func(T5) func(T6) func(T7) func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]]
HKT_F_T5_T6_T7_T8_T9_T10, // HKT[func(T5) func(T6) func(T7) func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]]
HKT_F_T6_T7_T8_T9_T10, // HKT[func(T6) func(T7) func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]]
HKT_F_T7_T8_T9_T10, // HKT[func(T7) func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]]
HKT_F_T8_T9_T10, // HKT[func(T8) func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]]
HKT_F_T9_T10, // HKT[func(T9) func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]]
HKT_F_T10, // HKT[func(T10) T.Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]]
HKT_TUPLE10 any, // HKT[Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]]
](
fmap MAP,
fap1 AP1,
fap2 AP2,
fap3 AP3,
fap4 AP4,
fap5 AP5,
fap6 AP6,
fap7 AP7,
fap8 AP8,
fap9 AP9,
t1 HKT_T1,
t2 HKT_T2,
t3 HKT_T3,
t4 HKT_T4,
t5 HKT_T5,
t6 HKT_T6,
t7 HKT_T7,
t8 HKT_T8,
t9 HKT_T9,
t10 HKT_T10,
) HKT_TUPLE10 {
return fap9(fap8(fap7(fap6(fap5(fap4(fap3(fap2(fap1(fmap(t1, tupleConstructor10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]()), t2), t3), t4), t5), t6), t7), t8), t9), t10)
}

View File

@@ -49,7 +49,7 @@ func MonadTraverse[MA ~map[K]A, MB ~map[K]B, K comparable, A, B, HKTB, HKTAB, HK
_ap func(HKTAB, HKTB) HKTRB,
r MA, f func(A) HKTB) HKTRB {
return traverseWithIndex(_of, _map, _ap, r, F.Ignore1st[K](f))
return traverseWithIndex(_of, _map, _ap, r, F.Ignore1of2[K](f))
}
func TraverseWithIndex[MA ~map[K]A, MB ~map[K]B, K comparable, A, B, HKTB, HKTAB, HKTRB any](

View File

@@ -123,5 +123,5 @@ func Reduce[A, B any](f func(B, A) B, initial B) func(Option[A]) B {
// Filter converts an optional onto itself if it is some and the predicate is true
func Filter[A any](pred func(A) bool) func(Option[A]) Option[A] {
return Fold(None[A], F.Ternary(pred, Of[A], F.Ignore1[A](None[A])))
return Fold(None[A], F.Ternary(pred, Of[A], F.Ignore1of1[A](None[A])))
}

View File

@@ -1,6 +1,6 @@
// Code generated by go generate; DO NOT EDIT.
// This file was generated by robots at
// 2023-07-13 17:33:44.6167774 +0200 CEST m=+0.036849901
// 2023-07-13 22:20:27.1434383 +0200 CEST m=+0.033978401
package option
// optionize converts a nullary function to an option

View File

@@ -1,8 +1,8 @@
package option
import (
Apply "github.com/ibm/fp-go/apply"
F "github.com/ibm/fp-go/function"
Apply "github.com/ibm/fp-go/internal/apply"
T "github.com/ibm/fp-go/tuple"
)

View File

@@ -1,6 +1,6 @@
// Code generated by go generate; DO NOT EDIT.
// This file was generated by robots at
// 2023-07-13 17:33:46.2312033 +0200 CEST m=+0.009503201
// 2023-07-13 22:20:30.1912026 +0200 CEST m=+0.048006501
package tuple