1
0
mirror of https://github.com/IBM/fp-go.git synced 2025-06-23 00:27:49 +02:00
Files
fp-go/main.go

26 lines
376 B
Go
Raw Normal View History

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)
}