diff --git a/main.nim b/main.nim new file mode 100644 index 00000000..5016a731 --- /dev/null +++ b/main.nim @@ -0,0 +1,8 @@ +# Run this file: +# nim c -r main.nim +# + +import ./somefn +import ./otherfn + +discard int.someFn() diff --git a/otherfn.nim b/otherfn.nim new file mode 100644 index 00000000..d091e230 --- /dev/null +++ b/otherfn.nim @@ -0,0 +1,10 @@ + +import pkg/questionable +import pkg/questionable/results + +import ./somefn + +proc otherFn*(): void = + + without x =? int.someFn(), err: + echo "was err" & err.msg diff --git a/somefn.nim b/somefn.nim new file mode 100644 index 00000000..94c6ff69 --- /dev/null +++ b/somefn.nim @@ -0,0 +1,14 @@ +import pkg/questionable +import pkg/questionable/results + +proc someFn*( + X: type int +): ?!int = + let res = success(1) + + if err =? res.errorOption: + echo "err" & err.msg + else: + echo "no err" + + failure("")