mirror of
https://github.com/IBM/fp-go.git
synced 2025-08-10 22:31:32 +02:00
fix: introduce stateless iterator
Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package generic
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
Logging "github.com/IBM/fp-go/logging"
|
||||
@@ -39,3 +40,11 @@ func Logf[GA ~func() any, A any](prefix string) func(A) GA {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Printf[GA ~func() any, A any](prefix string) func(A) GA {
|
||||
return func(a A) GA {
|
||||
return FromImpure[GA](func() {
|
||||
fmt.Printf(prefix, a)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@@ -31,3 +31,9 @@ func Logger[A any](loggers ...*log.Logger) func(string) func(A) IO[any] {
|
||||
func Logf[A any](prefix string) func(A) IO[any] {
|
||||
return G.Logf[IO[any], A](prefix)
|
||||
}
|
||||
|
||||
// Printf constructs a printer function that can be used with ChainXXXIOK
|
||||
// the string prefix contains the format string for the log value
|
||||
func Printf[A any](prefix string) func(A) IO[any] {
|
||||
return G.Printf[IO[any], A](prefix)
|
||||
}
|
||||
|
Reference in New Issue
Block a user