Open jtrakk opened 3 years ago
@keorn @jtrakk @iamed2 I think a pipe-like |>
syntax would be really nice.
I'm just using ⇶ (really ugly) as an example operator because we don't have any "cool" extra pipe operator that is available to bind. See this https://discourse.julialang.org/t/list-of-binary-infix-operators/32282/2
Something like this would be really handy. Just like rust's ?.
f(a::Int)::Result{Int, SomeError} = div(3, a)
g(a::Int)::Result{Int, SomeError} = a*2
h(x::Int) = f(x) ⇶ g # returns the f's error if x is 0, but unwraps result and passes it to g otherwise
Rust has a syntactic shortcut for propagating errors. Would a similar operator work in ResultTypes.jl?