Partial function that applies to the argument when the pattern matches.
List of symbols representing the variables used in the pattern, in the left-to-right order.
true
if the pattern will always match the argument of the correct type, false
otherwise.
true
if the pattern will always match the argument of the correct type, false
otherwise.
Detect whether the input pattern is irrefutable and will always match any given value.
Detect whether the input pattern is irrefutable and will always match any given value. An irrefutable pattern does not constrain the input value but merely puts variables on the value or on its parts.
Examples of irrefutable patterns are a(_)
, a(x)
, and a( z@(x,y,_) )
, where a(...)
is a molecule with a suitable value type.
Examples of refutable patterns are a(1)
, a(Some(x))
, a( (_, None) )
.
true
if the pattern is irrefutable, false
otherwise.
Partial function that applies to the argument when the pattern matches.
List of symbols representing the variables used in the pattern, in the left-to-right order.
Represents a general pattern that is neither a wildcard nor a single variable nor a constant. Examples of such patterns are
a(Some(x))
anda( (x, _, 2, List(a, b)) )
.A pattern is recognized to be _irrefutable_ when it is a tuple where all places are either simple variables or wildcards. For example,
a( z@(x, y, _) )
is an irrefutable pattern for a 3-tuple type. On the other hand,a( (x, _, Some(_) ) )
is not irrefutable because it fails to matcha( (_, _, None) )
. Another recognized case of irrefutable patterns is a single case class that extends a sealed trait.Partial function that applies to the argument when the pattern matches.
List of symbols representing the variables used in the pattern, in the left-to-right order.
true
if the pattern will always match the argument of the correct type,false
otherwise.