Interface with user-defined match monad?
if there's a match
in scope, we use this as the match strategy, assuming it conforms to MatchStrategy as defined below:
(Since version 2.10.0) Use leftOfArrow instead
(Since version 2.10.0) Use resultOfEnsuring instead
Translate pattern matching into method calls (these methods form a zero-plus monad), similar in spirit to how for-comprehensions are compiled.
For each case, express all patterns as extractor calls, guards as 0-ary extractors, and sequence them using
flatMap
(lifting the body of the case into the monad usingone
).Cases are combined into a pattern match using the
orElse
combinator (the implicit failure case is expressed using the monad'szero
).TODO:
(longer-term) TODO: