Results.jl provides a Result
and Option
type for computation,
as featured in Rust, Haskell (as Either
), OCaml, and many more.
This library is distributed under the LGPL v3.0 license.
The core Result
type is simply an alias for Union{Ok{T}, Err{E}}
,
allowing you to dispatch on Ok
and Err
variants separately.
The Option
type is defined as Union{Base.Some{T}, Base.Nothing}
,
allowing for easy compatibility with other libraries.
Results.jl
attempts to provide a compromise between strict type-safety
and maximum ergonomics. Compared to exceptions, Results.jl
is faster.
Compared with a bare nullable type Union{T, Nothing}
, Results.jl
is
more correct. And compared to other libraries, Results.jl
aims to be
more complete and more ergonomic.
Check out the documentation on JuliaHub.
Pull requests and issues are welcome. This is my first Julia package, so I'm expecting some criticism.