MLStyle.jl
MLStyle.jl copied to clipboard
documentation for active patterns (`@active`) is out-of-date while deprecation warning is up-to-date
https://github.com/thautwarm/MLStyle.jl/blob/2b7f0a7be19462ea741389266d5c3e04ead21409/src/StandardPatterns/Active.jl#L117-L147
julia> @active F(x) begin
if x > 0
nothing
else
:ok
end
end
julia>
julia> @match -1 begin
F(:ok) => false
_ => true
end # true
ERROR: invalid use of active patterns: 1-ary view pattern(F(x)) should accept Union{Some{T}, Nothing} instead of Union{T, Nothing}! A simple solution is:
(@active F(x) ex) =>
(@active F(x) let r=ex; r === nothing? r : Some(r)) end