mirror of
https://github.com/IBM/fp-go.git
synced 2025-12-19 23:42:05 +02:00
fix: try to unify type signatures
Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
@@ -107,8 +107,8 @@ Chain for sequential composition:
|
||||
// Chain multiple operations
|
||||
result := F.Pipe2(
|
||||
10,
|
||||
identity.Chain(func(n int) int { return n * 2 }),
|
||||
identity.Chain(func(n int) int { return n + 5 }),
|
||||
identity.Chain(N.Mul(2)),
|
||||
identity.Chain(N.Add(5)),
|
||||
)
|
||||
// result is 25
|
||||
|
||||
@@ -177,8 +177,8 @@ Convert tuples of Identity values:
|
||||
// Traverse with transformation
|
||||
tuple := T.MakeTuple2(1, 2)
|
||||
result := identity.TraverseTuple2(
|
||||
func(n int) int { return n * 2 },
|
||||
func(n int) int { return n * 3 },
|
||||
N.Mul(2),
|
||||
N.Mul(3),
|
||||
)(tuple)
|
||||
// result is T.Tuple2[int, int]{2, 6}
|
||||
|
||||
@@ -211,7 +211,7 @@ Example of generic code:
|
||||
) M {
|
||||
return F.Pipe2(
|
||||
monad.Of(value),
|
||||
monad.Map(func(n int) int { return n * 2 }),
|
||||
monad.Map(N.Mul(2)),
|
||||
monad.Map(func(n int) string { return fmt.Sprintf("%d", n) }),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user