Init
This commit is contained in:
@@ -14,6 +14,10 @@ proc findMaybeFn*[T, B](fns: seq[T {.nimcall.} -> Maybe[B]], val: T): Maybe[B] =
|
||||
return res
|
||||
return Nothing[B]()
|
||||
|
||||
proc notNegative*[int](x: Maybe[int]): Maybe[int] =
|
||||
## Maps nil object to nothing
|
||||
x.filter(i => i >= 0)
|
||||
|
||||
when isMainModule:
|
||||
echo @[
|
||||
(x: int) => (if x == 2: Just("foo") else: Nothing[string]()),
|
||||
|
||||
Reference in New Issue
Block a user