1
0
mirror of https://github.com/IBM/fp-go.git synced 2025-06-21 00:19:34 +02:00
Files
fp-go/main.go
Dr. Carsten Leue c07df5c771 initial checkin
Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
2023-07-07 22:31:06 +02:00

26 lines
376 B
Go

package main
import (
"fmt"
O "github.com/ibm/fp-go/option"
)
func isNonemptyString(val string) bool {
return val != ""
}
// var O = OptionModule{of: O_of, some: O_of, none: none, mp: OMap}
func main() {
opt_string := O.FromPredicate(isNonemptyString)
stringO1 := opt_string("Carsten")
stringO2 := opt_string("")
fmt.Println(stringO1)
fmt.Println(stringO2)
}