We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I thought this would work and the documentation doesn't have any examples of using Base.Pair as a pattern.
Base.Pair
using MLStyle s = 2=>3 @match s begin (a,b) => a (a=>b) => b end
The tuple line works fine, but then the pair line gives the following error on [d8e11817] MLStyle v0.4.17
[d8e11817] MLStyle v0.4.17
ERROR: LoadError: PatternCompilationError(:(#= Untitled-2:7 =#), MethodError(MLStyle.MatchImpl.pattern_uncall, (Pair, MLStyle.MatchImpl.ModuleBoundedEx2tf(Main), Any[], Any[], Any[:(s::Symbol), :(v::Any)]), 0x00000000000082b5)) Stacktrace: [1] gen_match(val::Symbol, tbl::Expr, __source__::LineNumberNode, __module__::Module) @ MLStyle.MatchImpl ~/.julia/packages/MLStyle/SLOsr/src/MatchImpl.jl:712 [2] var"@match"(__source__::LineNumberNode, __module__::Module, val::Any, tbl::Any) @ MLStyle.MatchImpl ~/.julia/packages/MLStyle/SLOsr/src/MatchImpl.jl:667 [3] eval
Replacing (a=>b) with Pair(a,b) doesn't fix it.
(a=>b)
Pair(a,b)
The text was updated successfully, but these errors were encountered:
Pair is not yet marked as a builtin pattern due to some unsolved design issues. You can try adding support in one line:
Pair
MLStyle.@as_record Pair #= @match value begin (p1 => p2) => v # or Pair(p1, p2) => v end =# @match (1=>2) begin (a, b) => a + b end
Sorry, something went wrong.
No branches or pull requests
I thought this would work and the documentation doesn't have any examples of using
Base.Pair
as a pattern.The tuple line works fine, but then the pair line gives the following error on
[d8e11817] MLStyle v0.4.17
Replacing
(a=>b)
withPair(a,b)
doesn't fix it.The text was updated successfully, but these errors were encountered: