fp.matching¶
fp.matching provides exhaustive pattern matching over algebraic data types,
Result, Optional and tuples of subjects. It also supports structural
recursion and bottom-up rewriting of inductive data types. Start with
algebraic data and pattern matching, then continue
with inductive data types.
Pattern matching on algebraic data: match, rewrite, when and Next.
match takes a Node value, or two or three values, and one to sixteen
clauses: plain functions or lambdas without captures, whose parameter types
select the constructors they handle. The clauses are checked when the program
compiles and the match runs as one loop, so it is exhaustive, ends on every
value and is not limited by the native stack. when adds a guard to a clause,
Next continues with a smaller value, and rewrite transforms a value
bottom-up. Declare data with fp.adt.Data, Cases and Node.
Summary¶
| Name | Kind | Summary |
|---|---|---|
match |
function | Match subject with clauses: the first that applies to it gives the result. |
rewrite |
function | Rewrite subject bottom-up with clauses for the constructors that change. |
when |
function | A clause that applies only when guard holds for the same argument. |
Guarded |
struct | The result of a when clause: a value when its guard held, nothing otherwise. |
Next |
struct | The result of the matched value is the result of matching node instead. |
Functions¶
match¶
Source: fp/matching/matcher.mojo
def `match`[ S: AnyType, A0: AnyType, O0: Value, E0: AnyType, // ](subject: S, f0: def(A0) raises E0 thin -> O0) raises _Error1[E0] -> _Result1[O0]
Match subject with clauses: the first that applies to it gives the result.
Takes one to sixteen clauses. A clause is a plain function or a lambda without
captures; its parameter type says which values it applies to, and a when
clause may decline. The clauses are checked when the program compiles. The
subject is one of:
- a
Node[F]: a clause takes a constructor ofF, whose recursive fields are declared either as stored,Node[F], or as the result type, in which case they arrive already matched; or it takesNode[F], which accepts any constructor. A clause returns the result orNext(node), to continue with a smaller value. - a value stored in place, such as
Choice[F]orResult[T, E]: a clause takes a constructor, or the whole type. - an
Optional[T]: a clause takesTfor a present value,NoneTypefor an absent one, orOptional[T].
Parameters
S(AnyType, inferred): The subject's type.A0(AnyType, inferred): The clause's parameter type.O0(Value, inferred): The clause's result type: the result,Next[Node[F]], or a guarded result.E0(AnyType, inferred): The clause's error type,Neverfor a pure clause.
Arguments
subject(S): The value to match, borrowed.f0(def(A0) raises E0 thin -> O0): The first clause; further clauses follow in order.
Returns
The result of the first clause that applies.
Raises
The clauses' common error; a match of pure clauses does not raise.
def `match`[ S: AnyType, X: AnyType, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, // ](subject: S, f0: def(A0, B0) raises E0 thin -> O0, *, context: X) raises _Error1[E0] -> _Result1[O0]
Match subject with clauses that also take context as their second parameter.
The context is borrowed and passed to every clause, for data the clauses need but the subject does not hold. Otherwise as the match without a context.
Parameters
S(AnyType, inferred): The subject's type.X(AnyType, inferred): The context type.A0(AnyType, inferred): The clause's parameter type.B0(AnyType, inferred): The clause's second parameter type, which must be the context type.O0(Value, inferred): The clause's result type: the result,Next[Node[F]], or a guarded result.E0(AnyType, inferred): The clause's error type,Neverfor a pure clause.
Arguments
subject(S): The value to match.f0(def(A0, B0) raises E0 thin -> O0): The first clause; further clauses follow in order.context(X): The value passed to every clause.
Returns
The result of the first clause that applies.
Raises
The clauses' common error; a match of pure clauses does not raise.
def `match`[ S0: Movable, S1: Movable, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, // ](subjects: Tuple[S0, S1], f0: def(A0, B0) raises E0 thin -> O0) raises _Error1[E0] -> _Result1[O0]
Match two subjects together: the first clause that applies to both gives the result.
A clause takes one parameter per subject, as for a single subject: a
constructor (for a Node, as stored) or the whole type, the type of a
present Optional value or NoneType, or for any other subject its type.
Every combination of cases must be covered. Nothing is evaluated recursively
and Next is not available.
Parameters
S0(Movable, inferred): The first subject's type.S1(Movable, inferred): The second subject's type.A0(AnyType, inferred): The clause's first parameter type.B0(AnyType, inferred): The clause's second parameter type.O0(Value, inferred): The clause's result type, or a guarded result.E0(AnyType, inferred): The clause's error type,Neverfor a pure clause.
Arguments
subjects(Tuple[S0, S1]): The values to match.f0(def(A0, B0) raises E0 thin -> O0): The first clause; further clauses follow in order.
Returns
The result of the first clause that applies.
Raises
The clauses' common error; a match of pure clauses does not raise.
def `match`[ S0: Movable, S1: Movable, S2: Movable, A0: AnyType, B0: AnyType, C0: AnyType, O0: Value, E0: AnyType, // ](subjects: Tuple[S0, S1, S2], f0: def(A0, B0, C0) raises E0 thin -> O0) raises _Error1[E0] -> _Result1[O0]
Match three subjects together: the first clause that applies to all of them gives the result.
As the match of two subjects, with one more parameter per clause.
Parameters
S0(Movable, inferred): The first subject's type.S1(Movable, inferred): The second subject's type.S2(Movable, inferred): The third subject's type.A0(AnyType, inferred): The clause's first parameter type.B0(AnyType, inferred): The clause's second parameter type.C0(AnyType, inferred): The clause's third parameter type.O0(Value, inferred): The clause's result type, or a guarded result.E0(AnyType, inferred): The clause's error type,Neverfor a pure clause.
Arguments
subjects(Tuple[S0, S1, S2]): The values to match.f0(def(A0, B0, C0) raises E0 thin -> O0): The first clause; further clauses follow in order.
Returns
The result of the first clause that applies.
Raises
The clauses' common error; a match of pure clauses does not raise.
60 more overloads
Match `subject` with 2 clauses.
def `match`[ S: AnyType, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1: AnyType, // ](subject: S, f0: def(A0) raises E0 thin -> O0, f1: def(A1) raises E1 thin -> O1) raises _Error2[E0, E1] -> _Result2[O0, O1]
Match `subject` with 3 clauses.
def `match`[ S: AnyType, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1: AnyType, A2: AnyType, O2: Value, E2: AnyType, // ](subject: S, f0: def(A0) raises E0 thin -> O0, f1: def(A1) raises E1 thin -> O1, f2: def(A2) raises E2 thin -> O2) raises _Error3[E0, E1, E2] -> _Result3[O0, O1, O2]
Match `subject` with 4 clauses.
def `match`[ S: AnyType, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1: AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3: AnyType, // ](subject: S, f0: def(A0) raises E0 thin -> O0, f1: def(A1) raises E1 thin -> O1, f2: def(A2) raises E2 thin -> O2, f3: def(A3) raises E3 thin -> O3) raises _Error4[E0, E1, E2, E3] -> _Result4[O0, O1, O2, O3]
Match `subject` with 5 clauses.
def `match`[ S: AnyType, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1: AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3: AnyType, A4: AnyType, O4: Value, E4: AnyType, // ](subject: S, f0: def(A0) raises E0 thin -> O0, f1: def(A1) raises E1 thin -> O1, f2: def(A2) raises E2 thin -> O2, f3: def(A3) raises E3 thin -> O3, f4: def(A4) raises E4 thin -> O4) raises _Error5[E0, E1, E2, E3, E4] -> _Result5[O0, O1, O2, O3, O4]
Match `subject` with 6 clauses.
def `match`[ S: AnyType, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1: AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3: AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5: AnyType, // ](subject: S, f0: def(A0) raises E0 thin -> O0, f1: def(A1) raises E1 thin -> O1, f2: def(A2) raises E2 thin -> O2, f3: def(A3) raises E3 thin -> O3, f4: def(A4) raises E4 thin -> O4, f5: def(A5) raises E5 thin -> O5) raises _Error6[E0, E1, E2, E3, E4, E5] -> _Result6[O0, O1, O2, O3, O4, O5]
Match `subject` with 7 clauses.
def `match`[ S: AnyType, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1: AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3: AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5: AnyType, A6: AnyType, O6: Value, E6: AnyType, // ](subject: S, f0: def(A0) raises E0 thin -> O0, f1: def(A1) raises E1 thin -> O1, f2: def(A2) raises E2 thin -> O2, f3: def(A3) raises E3 thin -> O3, f4: def(A4) raises E4 thin -> O4, f5: def(A5) raises E5 thin -> O5, f6: def(A6) raises E6 thin -> O6) raises _Error7[E0, E1, E2, E3, E4, E5, E6] -> _Result7[O0, O1, O2, O3, O4, O5, O6]
Match `subject` with 8 clauses.
def `match`[ S: AnyType, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1: AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3: AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5: AnyType, A6: AnyType, O6: Value, E6: AnyType, A7: AnyType, O7: Value, E7: AnyType, // ](subject: S, f0: def(A0) raises E0 thin -> O0, f1: def(A1) raises E1 thin -> O1, f2: def(A2) raises E2 thin -> O2, f3: def(A3) raises E3 thin -> O3, f4: def(A4) raises E4 thin -> O4, f5: def(A5) raises E5 thin -> O5, f6: def(A6) raises E6 thin -> O6, f7: def(A7) raises E7 thin -> O7) raises _Error8[E0, E1, E2, E3, E4, E5, E6, E7] -> _Result8[O0, O1, O2, O3, O4, O5, O6, O7]
Match `subject` with 9 clauses.
def `match`[ S: AnyType, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1: AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3: AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5: AnyType, A6: AnyType, O6: Value, E6: AnyType, A7: AnyType, O7: Value, E7: AnyType, A8: AnyType, O8: Value, E8: AnyType, // ](subject: S, f0: def(A0) raises E0 thin -> O0, f1: def(A1) raises E1 thin -> O1, f2: def(A2) raises E2 thin -> O2, f3: def(A3) raises E3 thin -> O3, f4: def(A4) raises E4 thin -> O4, f5: def(A5) raises E5 thin -> O5, f6: def(A6) raises E6 thin -> O6, f7: def(A7) raises E7 thin -> O7, f8: def(A8) raises E8 thin -> O8) raises _Error9[E0, E1, E2, E3, E4, E5, E6, E7, E8] -> _Result9[O0, O1, O2, O3, O4, O5, O6, O7, O8]
Match `subject` with 10 clauses.
def `match`[ S: AnyType, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1: AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3: AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5: AnyType, A6: AnyType, O6: Value, E6: AnyType, A7: AnyType, O7: Value, E7: AnyType, A8: AnyType, O8: Value, E8: AnyType, A9: AnyType, O9: Value, E9: AnyType, // ](subject: S, f0: def(A0) raises E0 thin -> O0, f1: def(A1) raises E1 thin -> O1, f2: def(A2) raises E2 thin -> O2, f3: def(A3) raises E3 thin -> O3, f4: def(A4) raises E4 thin -> O4, f5: def(A5) raises E5 thin -> O5, f6: def(A6) raises E6 thin -> O6, f7: def(A7) raises E7 thin -> O7, f8: def(A8) raises E8 thin -> O8, f9: def(A9) raises E9 thin -> O9) raises _Error10[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9] -> _Result10[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9]
Match `subject` with 11 clauses.
def `match`[ S: AnyType, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1: AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3: AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5: AnyType, A6: AnyType, O6: Value, E6: AnyType, A7: AnyType, O7: Value, E7: AnyType, A8: AnyType, O8: Value, E8: AnyType, A9: AnyType, O9: Value, E9: AnyType, A10: AnyType, O10: Value, E10: AnyType, // ](subject: S, f0: def(A0) raises E0 thin -> O0, f1: def(A1) raises E1 thin -> O1, f2: def(A2) raises E2 thin -> O2, f3: def(A3) raises E3 thin -> O3, f4: def(A4) raises E4 thin -> O4, f5: def(A5) raises E5 thin -> O5, f6: def(A6) raises E6 thin -> O6, f7: def(A7) raises E7 thin -> O7, f8: def(A8) raises E8 thin -> O8, f9: def(A9) raises E9 thin -> O9, f10: def(A10) raises E10 thin -> O10) raises _Error11[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10] -> _Result11[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10]
Match `subject` with 12 clauses.
def `match`[ S: AnyType, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1: AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3: AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5: AnyType, A6: AnyType, O6: Value, E6: AnyType, A7: AnyType, O7: Value, E7: AnyType, A8: AnyType, O8: Value, E8: AnyType, A9: AnyType, O9: Value, E9: AnyType, A10: AnyType, O10: Value, E10: AnyType, A11: AnyType, O11: Value, E11: AnyType, // ](subject: S, f0: def(A0) raises E0 thin -> O0, f1: def(A1) raises E1 thin -> O1, f2: def(A2) raises E2 thin -> O2, f3: def(A3) raises E3 thin -> O3, f4: def(A4) raises E4 thin -> O4, f5: def(A5) raises E5 thin -> O5, f6: def(A6) raises E6 thin -> O6, f7: def(A7) raises E7 thin -> O7, f8: def(A8) raises E8 thin -> O8, f9: def(A9) raises E9 thin -> O9, f10: def(A10) raises E10 thin -> O10, f11: def(A11) raises E11 thin -> O11) raises _Error12[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11] -> _Result12[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11]
Match `subject` with 13 clauses.
def `match`[ S: AnyType, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1: AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3: AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5: AnyType, A6: AnyType, O6: Value, E6: AnyType, A7: AnyType, O7: Value, E7: AnyType, A8: AnyType, O8: Value, E8: AnyType, A9: AnyType, O9: Value, E9: AnyType, A10: AnyType, O10: Value, E10: AnyType, A11: AnyType, O11: Value, E11: AnyType, A12: AnyType, O12: Value, E12: AnyType, // ](subject: S, f0: def(A0) raises E0 thin -> O0, f1: def(A1) raises E1 thin -> O1, f2: def(A2) raises E2 thin -> O2, f3: def(A3) raises E3 thin -> O3, f4: def(A4) raises E4 thin -> O4, f5: def(A5) raises E5 thin -> O5, f6: def(A6) raises E6 thin -> O6, f7: def(A7) raises E7 thin -> O7, f8: def(A8) raises E8 thin -> O8, f9: def(A9) raises E9 thin -> O9, f10: def(A10) raises E10 thin -> O10, f11: def(A11) raises E11 thin -> O11, f12: def(A12) raises E12 thin -> O12) raises _Error13[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12] -> _Result13[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11, O12]
Match `subject` with 14 clauses.
def `match`[ S: AnyType, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1: AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3: AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5: AnyType, A6: AnyType, O6: Value, E6: AnyType, A7: AnyType, O7: Value, E7: AnyType, A8: AnyType, O8: Value, E8: AnyType, A9: AnyType, O9: Value, E9: AnyType, A10: AnyType, O10: Value, E10: AnyType, A11: AnyType, O11: Value, E11: AnyType, A12: AnyType, O12: Value, E12: AnyType, A13: AnyType, O13: Value, E13: AnyType, // ](subject: S, f0: def(A0) raises E0 thin -> O0, f1: def(A1) raises E1 thin -> O1, f2: def(A2) raises E2 thin -> O2, f3: def(A3) raises E3 thin -> O3, f4: def(A4) raises E4 thin -> O4, f5: def(A5) raises E5 thin -> O5, f6: def(A6) raises E6 thin -> O6, f7: def(A7) raises E7 thin -> O7, f8: def(A8) raises E8 thin -> O8, f9: def(A9) raises E9 thin -> O9, f10: def(A10) raises E10 thin -> O10, f11: def(A11) raises E11 thin -> O11, f12: def(A12) raises E12 thin -> O12, f13: def(A13) raises E13 thin -> O13) raises _Error14[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13] -> _Result14[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11, O12, O13]
Match `subject` with 15 clauses.
def `match`[ S: AnyType, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1: AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3: AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5: AnyType, A6: AnyType, O6: Value, E6: AnyType, A7: AnyType, O7: Value, E7: AnyType, A8: AnyType, O8: Value, E8: AnyType, A9: AnyType, O9: Value, E9: AnyType, A10: AnyType, O10: Value, E10: AnyType, A11: AnyType, O11: Value, E11: AnyType, A12: AnyType, O12: Value, E12: AnyType, A13: AnyType, O13: Value, E13: AnyType, A14: AnyType, O14: Value, E14: AnyType, // ](subject: S, f0: def(A0) raises E0 thin -> O0, f1: def(A1) raises E1 thin -> O1, f2: def(A2) raises E2 thin -> O2, f3: def(A3) raises E3 thin -> O3, f4: def(A4) raises E4 thin -> O4, f5: def(A5) raises E5 thin -> O5, f6: def(A6) raises E6 thin -> O6, f7: def(A7) raises E7 thin -> O7, f8: def(A8) raises E8 thin -> O8, f9: def(A9) raises E9 thin -> O9, f10: def(A10) raises E10 thin -> O10, f11: def(A11) raises E11 thin -> O11, f12: def(A12) raises E12 thin -> O12, f13: def(A13) raises E13 thin -> O13, f14: def(A14) raises E14 thin -> O14) raises _Error15[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13, E14] -> _Result15[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11, O12, O13, O14]
Match `subject` with 16 clauses.
def `match`[ S: AnyType, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1: AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3: AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5: AnyType, A6: AnyType, O6: Value, E6: AnyType, A7: AnyType, O7: Value, E7: AnyType, A8: AnyType, O8: Value, E8: AnyType, A9: AnyType, O9: Value, E9: AnyType, A10: AnyType, O10: Value, E10: AnyType, A11: AnyType, O11: Value, E11: AnyType, A12: AnyType, O12: Value, E12: AnyType, A13: AnyType, O13: Value, E13: AnyType, A14: AnyType, O14: Value, E14: AnyType, A15: AnyType, O15: Value, E15: AnyType, // ](subject: S, f0: def(A0) raises E0 thin -> O0, f1: def(A1) raises E1 thin -> O1, f2: def(A2) raises E2 thin -> O2, f3: def(A3) raises E3 thin -> O3, f4: def(A4) raises E4 thin -> O4, f5: def(A5) raises E5 thin -> O5, f6: def(A6) raises E6 thin -> O6, f7: def(A7) raises E7 thin -> O7, f8: def(A8) raises E8 thin -> O8, f9: def(A9) raises E9 thin -> O9, f10: def(A10) raises E10 thin -> O10, f11: def(A11) raises E11 thin -> O11, f12: def(A12) raises E12 thin -> O12, f13: def(A13) raises E13 thin -> O13, f14: def(A14) raises E14 thin -> O14, f15: def(A15) raises E15 thin -> O15) raises _Error16[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13, E14, E15] -> _Result16[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11, O12, O13, O14, O15]
Match `subject` with 2 clauses that also take `context`.
def `match`[ S: AnyType, X: AnyType, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, // ](subject: S, f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, *, context: X) raises _Error2[E0, E1] -> _Result2[O0, O1]
Match `subject` with 3 clauses that also take `context`.
def `match`[ S: AnyType, X: AnyType, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, // ](subject: S, f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, *, context: X) raises _Error3[E0, E1, E2] -> _Result3[O0, O1, O2]
Match `subject` with 4 clauses that also take `context`.
def `match`[ S: AnyType, X: AnyType, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, // ](subject: S, f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, *, context: X) raises _Error4[E0, E1, E2, E3] -> _Result4[O0, O1, O2, O3]
Match `subject` with 5 clauses that also take `context`.
def `match`[ S: AnyType, X: AnyType, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, // ](subject: S, f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, *, context: X) raises _Error5[E0, E1, E2, E3, E4] -> _Result5[O0, O1, O2, O3, O4]
Match `subject` with 6 clauses that also take `context`.
def `match`[ S: AnyType, X: AnyType, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, // ](subject: S, f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, *, context: X) raises _Error6[E0, E1, E2, E3, E4, E5] -> _Result6[O0, O1, O2, O3, O4, O5]
Match `subject` with 7 clauses that also take `context`.
def `match`[ S: AnyType, X: AnyType, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, O6: Value, E6: AnyType, // ](subject: S, f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, f6: def(A6, B6) raises E6 thin -> O6, *, context: X) raises _Error7[E0, E1, E2, E3, E4, E5, E6] -> _Result7[O0, O1, O2, O3, O4, O5, O6]
Match `subject` with 8 clauses that also take `context`.
def `match`[ S: AnyType, X: AnyType, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, O7: Value, E7: AnyType, // ](subject: S, f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, f6: def(A6, B6) raises E6 thin -> O6, f7: def(A7, B7) raises E7 thin -> O7, *, context: X) raises _Error8[E0, E1, E2, E3, E4, E5, E6, E7] -> _Result8[O0, O1, O2, O3, O4, O5, O6, O7]
Match `subject` with 9 clauses that also take `context`.
def `match`[ S: AnyType, X: AnyType, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, O8: Value, E8: AnyType, // ](subject: S, f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, f6: def(A6, B6) raises E6 thin -> O6, f7: def(A7, B7) raises E7 thin -> O7, f8: def(A8, B8) raises E8 thin -> O8, *, context: X) raises _Error9[E0, E1, E2, E3, E4, E5, E6, E7, E8] -> _Result9[O0, O1, O2, O3, O4, O5, O6, O7, O8]
Match `subject` with 10 clauses that also take `context`.
def `match`[ S: AnyType, X: AnyType, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, O9: Value, E9: AnyType, // ](subject: S, f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, f6: def(A6, B6) raises E6 thin -> O6, f7: def(A7, B7) raises E7 thin -> O7, f8: def(A8, B8) raises E8 thin -> O8, f9: def(A9, B9) raises E9 thin -> O9, *, context: X) raises _Error10[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9] -> _Result10[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9]
Match `subject` with 11 clauses that also take `context`.
def `match`[ S: AnyType, X: AnyType, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, O9: Value, E9: AnyType, A10: AnyType, B10: AnyType, O10: Value, E10: AnyType, // ](subject: S, f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, f6: def(A6, B6) raises E6 thin -> O6, f7: def(A7, B7) raises E7 thin -> O7, f8: def(A8, B8) raises E8 thin -> O8, f9: def(A9, B9) raises E9 thin -> O9, f10: def(A10, B10) raises E10 thin -> O10, *, context: X) raises _Error11[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10] -> _Result11[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10]
Match `subject` with 12 clauses that also take `context`.
def `match`[ S: AnyType, X: AnyType, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, O9: Value, E9: AnyType, A10: AnyType, B10: AnyType, O10: Value, E10: AnyType, A11: AnyType, B11: AnyType, O11: Value, E11: AnyType, // ](subject: S, f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, f6: def(A6, B6) raises E6 thin -> O6, f7: def(A7, B7) raises E7 thin -> O7, f8: def(A8, B8) raises E8 thin -> O8, f9: def(A9, B9) raises E9 thin -> O9, f10: def(A10, B10) raises E10 thin -> O10, f11: def(A11, B11) raises E11 thin -> O11, *, context: X) raises _Error12[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11] -> _Result12[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11]
Match `subject` with 13 clauses that also take `context`.
def `match`[ S: AnyType, X: AnyType, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, O9: Value, E9: AnyType, A10: AnyType, B10: AnyType, O10: Value, E10: AnyType, A11: AnyType, B11: AnyType, O11: Value, E11: AnyType, A12: AnyType, B12: AnyType, O12: Value, E12: AnyType, // ](subject: S, f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, f6: def(A6, B6) raises E6 thin -> O6, f7: def(A7, B7) raises E7 thin -> O7, f8: def(A8, B8) raises E8 thin -> O8, f9: def(A9, B9) raises E9 thin -> O9, f10: def(A10, B10) raises E10 thin -> O10, f11: def(A11, B11) raises E11 thin -> O11, f12: def(A12, B12) raises E12 thin -> O12, *, context: X) raises _Error13[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12] -> _Result13[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11, O12]
Match `subject` with 14 clauses that also take `context`.
def `match`[ S: AnyType, X: AnyType, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, O9: Value, E9: AnyType, A10: AnyType, B10: AnyType, O10: Value, E10: AnyType, A11: AnyType, B11: AnyType, O11: Value, E11: AnyType, A12: AnyType, B12: AnyType, O12: Value, E12: AnyType, A13: AnyType, B13: AnyType, O13: Value, E13: AnyType, // ](subject: S, f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, f6: def(A6, B6) raises E6 thin -> O6, f7: def(A7, B7) raises E7 thin -> O7, f8: def(A8, B8) raises E8 thin -> O8, f9: def(A9, B9) raises E9 thin -> O9, f10: def(A10, B10) raises E10 thin -> O10, f11: def(A11, B11) raises E11 thin -> O11, f12: def(A12, B12) raises E12 thin -> O12, f13: def(A13, B13) raises E13 thin -> O13, *, context: X) raises _Error14[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13] -> _Result14[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11, O12, O13]
Match `subject` with 15 clauses that also take `context`.
def `match`[ S: AnyType, X: AnyType, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, O9: Value, E9: AnyType, A10: AnyType, B10: AnyType, O10: Value, E10: AnyType, A11: AnyType, B11: AnyType, O11: Value, E11: AnyType, A12: AnyType, B12: AnyType, O12: Value, E12: AnyType, A13: AnyType, B13: AnyType, O13: Value, E13: AnyType, A14: AnyType, B14: AnyType, O14: Value, E14: AnyType, // ](subject: S, f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, f6: def(A6, B6) raises E6 thin -> O6, f7: def(A7, B7) raises E7 thin -> O7, f8: def(A8, B8) raises E8 thin -> O8, f9: def(A9, B9) raises E9 thin -> O9, f10: def(A10, B10) raises E10 thin -> O10, f11: def(A11, B11) raises E11 thin -> O11, f12: def(A12, B12) raises E12 thin -> O12, f13: def(A13, B13) raises E13 thin -> O13, f14: def(A14, B14) raises E14 thin -> O14, *, context: X) raises _Error15[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13, E14] -> _Result15[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11, O12, O13, O14]
Match `subject` with 16 clauses that also take `context`.
def `match`[ S: AnyType, X: AnyType, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, O9: Value, E9: AnyType, A10: AnyType, B10: AnyType, O10: Value, E10: AnyType, A11: AnyType, B11: AnyType, O11: Value, E11: AnyType, A12: AnyType, B12: AnyType, O12: Value, E12: AnyType, A13: AnyType, B13: AnyType, O13: Value, E13: AnyType, A14: AnyType, B14: AnyType, O14: Value, E14: AnyType, A15: AnyType, B15: AnyType, O15: Value, E15: AnyType, // ](subject: S, f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, f6: def(A6, B6) raises E6 thin -> O6, f7: def(A7, B7) raises E7 thin -> O7, f8: def(A8, B8) raises E8 thin -> O8, f9: def(A9, B9) raises E9 thin -> O9, f10: def(A10, B10) raises E10 thin -> O10, f11: def(A11, B11) raises E11 thin -> O11, f12: def(A12, B12) raises E12 thin -> O12, f13: def(A13, B13) raises E13 thin -> O13, f14: def(A14, B14) raises E14 thin -> O14, f15: def(A15, B15) raises E15 thin -> O15, *, context: X) raises _Error16[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13, E14, E15] -> _Result16[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11, O12, O13, O14, O15]
Match two subjects with 2 clauses.
def `match`[ S0: Movable, S1: Movable, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, // ](subjects: Tuple[S0, S1], f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1) raises _Error2[E0, E1] -> _Result2[O0, O1]
Match two subjects with 3 clauses.
def `match`[ S0: Movable, S1: Movable, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, // ](subjects: Tuple[S0, S1], f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2) raises _Error3[E0, E1, E2] -> _Result3[O0, O1, O2]
Match two subjects with 4 clauses.
def `match`[ S0: Movable, S1: Movable, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, // ](subjects: Tuple[S0, S1], f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3) raises _Error4[E0, E1, E2, E3] -> _Result4[O0, O1, O2, O3]
Match two subjects with 5 clauses.
def `match`[ S0: Movable, S1: Movable, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, // ](subjects: Tuple[S0, S1], f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4) raises _Error5[E0, E1, E2, E3, E4] -> _Result5[O0, O1, O2, O3, O4]
Match two subjects with 6 clauses.
def `match`[ S0: Movable, S1: Movable, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, // ](subjects: Tuple[S0, S1], f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5) raises _Error6[E0, E1, E2, E3, E4, E5] -> _Result6[O0, O1, O2, O3, O4, O5]
Match two subjects with 7 clauses.
def `match`[ S0: Movable, S1: Movable, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, O6: Value, E6: AnyType, // ](subjects: Tuple[S0, S1], f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, f6: def(A6, B6) raises E6 thin -> O6) raises _Error7[E0, E1, E2, E3, E4, E5, E6] -> _Result7[O0, O1, O2, O3, O4, O5, O6]
Match two subjects with 8 clauses.
def `match`[ S0: Movable, S1: Movable, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, O7: Value, E7: AnyType, // ](subjects: Tuple[S0, S1], f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, f6: def(A6, B6) raises E6 thin -> O6, f7: def(A7, B7) raises E7 thin -> O7) raises _Error8[E0, E1, E2, E3, E4, E5, E6, E7] -> _Result8[O0, O1, O2, O3, O4, O5, O6, O7]
Match two subjects with 9 clauses.
def `match`[ S0: Movable, S1: Movable, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, O8: Value, E8: AnyType, // ](subjects: Tuple[S0, S1], f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, f6: def(A6, B6) raises E6 thin -> O6, f7: def(A7, B7) raises E7 thin -> O7, f8: def(A8, B8) raises E8 thin -> O8) raises _Error9[E0, E1, E2, E3, E4, E5, E6, E7, E8] -> _Result9[O0, O1, O2, O3, O4, O5, O6, O7, O8]
Match two subjects with 10 clauses.
def `match`[ S0: Movable, S1: Movable, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, O9: Value, E9: AnyType, // ](subjects: Tuple[S0, S1], f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, f6: def(A6, B6) raises E6 thin -> O6, f7: def(A7, B7) raises E7 thin -> O7, f8: def(A8, B8) raises E8 thin -> O8, f9: def(A9, B9) raises E9 thin -> O9) raises _Error10[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9] -> _Result10[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9]
Match two subjects with 11 clauses.
def `match`[ S0: Movable, S1: Movable, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, O9: Value, E9: AnyType, A10: AnyType, B10: AnyType, O10: Value, E10: AnyType, // ](subjects: Tuple[S0, S1], f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, f6: def(A6, B6) raises E6 thin -> O6, f7: def(A7, B7) raises E7 thin -> O7, f8: def(A8, B8) raises E8 thin -> O8, f9: def(A9, B9) raises E9 thin -> O9, f10: def(A10, B10) raises E10 thin -> O10) raises _Error11[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10] -> _Result11[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10]
Match two subjects with 12 clauses.
def `match`[ S0: Movable, S1: Movable, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, O9: Value, E9: AnyType, A10: AnyType, B10: AnyType, O10: Value, E10: AnyType, A11: AnyType, B11: AnyType, O11: Value, E11: AnyType, // ](subjects: Tuple[S0, S1], f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, f6: def(A6, B6) raises E6 thin -> O6, f7: def(A7, B7) raises E7 thin -> O7, f8: def(A8, B8) raises E8 thin -> O8, f9: def(A9, B9) raises E9 thin -> O9, f10: def(A10, B10) raises E10 thin -> O10, f11: def(A11, B11) raises E11 thin -> O11) raises _Error12[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11] -> _Result12[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11]
Match two subjects with 13 clauses.
def `match`[ S0: Movable, S1: Movable, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, O9: Value, E9: AnyType, A10: AnyType, B10: AnyType, O10: Value, E10: AnyType, A11: AnyType, B11: AnyType, O11: Value, E11: AnyType, A12: AnyType, B12: AnyType, O12: Value, E12: AnyType, // ](subjects: Tuple[S0, S1], f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, f6: def(A6, B6) raises E6 thin -> O6, f7: def(A7, B7) raises E7 thin -> O7, f8: def(A8, B8) raises E8 thin -> O8, f9: def(A9, B9) raises E9 thin -> O9, f10: def(A10, B10) raises E10 thin -> O10, f11: def(A11, B11) raises E11 thin -> O11, f12: def(A12, B12) raises E12 thin -> O12) raises _Error13[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12] -> _Result13[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11, O12]
Match two subjects with 14 clauses.
def `match`[ S0: Movable, S1: Movable, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, O9: Value, E9: AnyType, A10: AnyType, B10: AnyType, O10: Value, E10: AnyType, A11: AnyType, B11: AnyType, O11: Value, E11: AnyType, A12: AnyType, B12: AnyType, O12: Value, E12: AnyType, A13: AnyType, B13: AnyType, O13: Value, E13: AnyType, // ](subjects: Tuple[S0, S1], f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, f6: def(A6, B6) raises E6 thin -> O6, f7: def(A7, B7) raises E7 thin -> O7, f8: def(A8, B8) raises E8 thin -> O8, f9: def(A9, B9) raises E9 thin -> O9, f10: def(A10, B10) raises E10 thin -> O10, f11: def(A11, B11) raises E11 thin -> O11, f12: def(A12, B12) raises E12 thin -> O12, f13: def(A13, B13) raises E13 thin -> O13) raises _Error14[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13] -> _Result14[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11, O12, O13]
Match two subjects with 15 clauses.
def `match`[ S0: Movable, S1: Movable, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, O9: Value, E9: AnyType, A10: AnyType, B10: AnyType, O10: Value, E10: AnyType, A11: AnyType, B11: AnyType, O11: Value, E11: AnyType, A12: AnyType, B12: AnyType, O12: Value, E12: AnyType, A13: AnyType, B13: AnyType, O13: Value, E13: AnyType, A14: AnyType, B14: AnyType, O14: Value, E14: AnyType, // ](subjects: Tuple[S0, S1], f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, f6: def(A6, B6) raises E6 thin -> O6, f7: def(A7, B7) raises E7 thin -> O7, f8: def(A8, B8) raises E8 thin -> O8, f9: def(A9, B9) raises E9 thin -> O9, f10: def(A10, B10) raises E10 thin -> O10, f11: def(A11, B11) raises E11 thin -> O11, f12: def(A12, B12) raises E12 thin -> O12, f13: def(A13, B13) raises E13 thin -> O13, f14: def(A14, B14) raises E14 thin -> O14) raises _Error15[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13, E14] -> _Result15[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11, O12, O13, O14]
Match two subjects with 16 clauses.
def `match`[ S0: Movable, S1: Movable, A0: AnyType, B0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, O9: Value, E9: AnyType, A10: AnyType, B10: AnyType, O10: Value, E10: AnyType, A11: AnyType, B11: AnyType, O11: Value, E11: AnyType, A12: AnyType, B12: AnyType, O12: Value, E12: AnyType, A13: AnyType, B13: AnyType, O13: Value, E13: AnyType, A14: AnyType, B14: AnyType, O14: Value, E14: AnyType, A15: AnyType, B15: AnyType, O15: Value, E15: AnyType, // ](subjects: Tuple[S0, S1], f0: def(A0, B0) raises E0 thin -> O0, f1: def(A1, B1) raises E1 thin -> O1, f2: def(A2, B2) raises E2 thin -> O2, f3: def(A3, B3) raises E3 thin -> O3, f4: def(A4, B4) raises E4 thin -> O4, f5: def(A5, B5) raises E5 thin -> O5, f6: def(A6, B6) raises E6 thin -> O6, f7: def(A7, B7) raises E7 thin -> O7, f8: def(A8, B8) raises E8 thin -> O8, f9: def(A9, B9) raises E9 thin -> O9, f10: def(A10, B10) raises E10 thin -> O10, f11: def(A11, B11) raises E11 thin -> O11, f12: def(A12, B12) raises E12 thin -> O12, f13: def(A13, B13) raises E13 thin -> O13, f14: def(A14, B14) raises E14 thin -> O14, f15: def(A15, B15) raises E15 thin -> O15) raises _Error16[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13, E14, E15] -> _Result16[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11, O12, O13, O14, O15]
Match three subjects with 2 clauses.
def `match`[ S0: Movable, S1: Movable, S2: Movable, A0: AnyType, B0: AnyType, C0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, C1: AnyType, O1: Value, E1: AnyType, // ](subjects: Tuple[S0, S1, S2], f0: def(A0, B0, C0) raises E0 thin -> O0, f1: def(A1, B1, C1) raises E1 thin -> O1) raises _Error2[E0, E1] -> _Result2[O0, O1]
Match three subjects with 3 clauses.
def `match`[ S0: Movable, S1: Movable, S2: Movable, A0: AnyType, B0: AnyType, C0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, C1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, C2: AnyType, O2: Value, E2: AnyType, // ](subjects: Tuple[S0, S1, S2], f0: def(A0, B0, C0) raises E0 thin -> O0, f1: def(A1, B1, C1) raises E1 thin -> O1, f2: def(A2, B2, C2) raises E2 thin -> O2) raises _Error3[E0, E1, E2] -> _Result3[O0, O1, O2]
Match three subjects with 4 clauses.
def `match`[ S0: Movable, S1: Movable, S2: Movable, A0: AnyType, B0: AnyType, C0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, C1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, C2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, C3: AnyType, O3: Value, E3: AnyType, // ](subjects: Tuple[S0, S1, S2], f0: def(A0, B0, C0) raises E0 thin -> O0, f1: def(A1, B1, C1) raises E1 thin -> O1, f2: def(A2, B2, C2) raises E2 thin -> O2, f3: def(A3, B3, C3) raises E3 thin -> O3) raises _Error4[E0, E1, E2, E3] -> _Result4[O0, O1, O2, O3]
Match three subjects with 5 clauses.
def `match`[ S0: Movable, S1: Movable, S2: Movable, A0: AnyType, B0: AnyType, C0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, C1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, C2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, C3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, C4: AnyType, O4: Value, E4: AnyType, // ](subjects: Tuple[S0, S1, S2], f0: def(A0, B0, C0) raises E0 thin -> O0, f1: def(A1, B1, C1) raises E1 thin -> O1, f2: def(A2, B2, C2) raises E2 thin -> O2, f3: def(A3, B3, C3) raises E3 thin -> O3, f4: def(A4, B4, C4) raises E4 thin -> O4) raises _Error5[E0, E1, E2, E3, E4] -> _Result5[O0, O1, O2, O3, O4]
Match three subjects with 6 clauses.
def `match`[ S0: Movable, S1: Movable, S2: Movable, A0: AnyType, B0: AnyType, C0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, C1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, C2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, C3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, C4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, C5: AnyType, O5: Value, E5: AnyType, // ](subjects: Tuple[S0, S1, S2], f0: def(A0, B0, C0) raises E0 thin -> O0, f1: def(A1, B1, C1) raises E1 thin -> O1, f2: def(A2, B2, C2) raises E2 thin -> O2, f3: def(A3, B3, C3) raises E3 thin -> O3, f4: def(A4, B4, C4) raises E4 thin -> O4, f5: def(A5, B5, C5) raises E5 thin -> O5) raises _Error6[E0, E1, E2, E3, E4, E5] -> _Result6[O0, O1, O2, O3, O4, O5]
Match three subjects with 7 clauses.
def `match`[ S0: Movable, S1: Movable, S2: Movable, A0: AnyType, B0: AnyType, C0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, C1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, C2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, C3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, C4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, C5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, C6: AnyType, O6: Value, E6: AnyType, // ](subjects: Tuple[S0, S1, S2], f0: def(A0, B0, C0) raises E0 thin -> O0, f1: def(A1, B1, C1) raises E1 thin -> O1, f2: def(A2, B2, C2) raises E2 thin -> O2, f3: def(A3, B3, C3) raises E3 thin -> O3, f4: def(A4, B4, C4) raises E4 thin -> O4, f5: def(A5, B5, C5) raises E5 thin -> O5, f6: def(A6, B6, C6) raises E6 thin -> O6) raises _Error7[E0, E1, E2, E3, E4, E5, E6] -> _Result7[O0, O1, O2, O3, O4, O5, O6]
Match three subjects with 8 clauses.
def `match`[ S0: Movable, S1: Movable, S2: Movable, A0: AnyType, B0: AnyType, C0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, C1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, C2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, C3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, C4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, C5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, C6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, C7: AnyType, O7: Value, E7: AnyType, // ](subjects: Tuple[S0, S1, S2], f0: def(A0, B0, C0) raises E0 thin -> O0, f1: def(A1, B1, C1) raises E1 thin -> O1, f2: def(A2, B2, C2) raises E2 thin -> O2, f3: def(A3, B3, C3) raises E3 thin -> O3, f4: def(A4, B4, C4) raises E4 thin -> O4, f5: def(A5, B5, C5) raises E5 thin -> O5, f6: def(A6, B6, C6) raises E6 thin -> O6, f7: def(A7, B7, C7) raises E7 thin -> O7) raises _Error8[E0, E1, E2, E3, E4, E5, E6, E7] -> _Result8[O0, O1, O2, O3, O4, O5, O6, O7]
Match three subjects with 9 clauses.
def `match`[ S0: Movable, S1: Movable, S2: Movable, A0: AnyType, B0: AnyType, C0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, C1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, C2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, C3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, C4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, C5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, C6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, C7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, C8: AnyType, O8: Value, E8: AnyType, // ](subjects: Tuple[S0, S1, S2], f0: def(A0, B0, C0) raises E0 thin -> O0, f1: def(A1, B1, C1) raises E1 thin -> O1, f2: def(A2, B2, C2) raises E2 thin -> O2, f3: def(A3, B3, C3) raises E3 thin -> O3, f4: def(A4, B4, C4) raises E4 thin -> O4, f5: def(A5, B5, C5) raises E5 thin -> O5, f6: def(A6, B6, C6) raises E6 thin -> O6, f7: def(A7, B7, C7) raises E7 thin -> O7, f8: def(A8, B8, C8) raises E8 thin -> O8) raises _Error9[E0, E1, E2, E3, E4, E5, E6, E7, E8] -> _Result9[O0, O1, O2, O3, O4, O5, O6, O7, O8]
Match three subjects with 10 clauses.
def `match`[ S0: Movable, S1: Movable, S2: Movable, A0: AnyType, B0: AnyType, C0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, C1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, C2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, C3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, C4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, C5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, C6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, C7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, C8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, C9: AnyType, O9: Value, E9: AnyType, // ](subjects: Tuple[S0, S1, S2], f0: def(A0, B0, C0) raises E0 thin -> O0, f1: def(A1, B1, C1) raises E1 thin -> O1, f2: def(A2, B2, C2) raises E2 thin -> O2, f3: def(A3, B3, C3) raises E3 thin -> O3, f4: def(A4, B4, C4) raises E4 thin -> O4, f5: def(A5, B5, C5) raises E5 thin -> O5, f6: def(A6, B6, C6) raises E6 thin -> O6, f7: def(A7, B7, C7) raises E7 thin -> O7, f8: def(A8, B8, C8) raises E8 thin -> O8, f9: def(A9, B9, C9) raises E9 thin -> O9) raises _Error10[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9] -> _Result10[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9]
Match three subjects with 11 clauses.
def `match`[ S0: Movable, S1: Movable, S2: Movable, A0: AnyType, B0: AnyType, C0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, C1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, C2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, C3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, C4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, C5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, C6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, C7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, C8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, C9: AnyType, O9: Value, E9: AnyType, A10: AnyType, B10: AnyType, C10: AnyType, O10: Value, E10: AnyType, // ](subjects: Tuple[S0, S1, S2], f0: def(A0, B0, C0) raises E0 thin -> O0, f1: def(A1, B1, C1) raises E1 thin -> O1, f2: def(A2, B2, C2) raises E2 thin -> O2, f3: def(A3, B3, C3) raises E3 thin -> O3, f4: def(A4, B4, C4) raises E4 thin -> O4, f5: def(A5, B5, C5) raises E5 thin -> O5, f6: def(A6, B6, C6) raises E6 thin -> O6, f7: def(A7, B7, C7) raises E7 thin -> O7, f8: def(A8, B8, C8) raises E8 thin -> O8, f9: def(A9, B9, C9) raises E9 thin -> O9, f10: def(A10, B10, C10) raises E10 thin -> O10) raises _Error11[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10] -> _Result11[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10]
Match three subjects with 12 clauses.
def `match`[ S0: Movable, S1: Movable, S2: Movable, A0: AnyType, B0: AnyType, C0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, C1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, C2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, C3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, C4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, C5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, C6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, C7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, C8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, C9: AnyType, O9: Value, E9: AnyType, A10: AnyType, B10: AnyType, C10: AnyType, O10: Value, E10: AnyType, A11: AnyType, B11: AnyType, C11: AnyType, O11: Value, E11: AnyType, // ](subjects: Tuple[S0, S1, S2], f0: def(A0, B0, C0) raises E0 thin -> O0, f1: def(A1, B1, C1) raises E1 thin -> O1, f2: def(A2, B2, C2) raises E2 thin -> O2, f3: def(A3, B3, C3) raises E3 thin -> O3, f4: def(A4, B4, C4) raises E4 thin -> O4, f5: def(A5, B5, C5) raises E5 thin -> O5, f6: def(A6, B6, C6) raises E6 thin -> O6, f7: def(A7, B7, C7) raises E7 thin -> O7, f8: def(A8, B8, C8) raises E8 thin -> O8, f9: def(A9, B9, C9) raises E9 thin -> O9, f10: def(A10, B10, C10) raises E10 thin -> O10, f11: def(A11, B11, C11) raises E11 thin -> O11) raises _Error12[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11] -> _Result12[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11]
Match three subjects with 13 clauses.
def `match`[ S0: Movable, S1: Movable, S2: Movable, A0: AnyType, B0: AnyType, C0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, C1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, C2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, C3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, C4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, C5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, C6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, C7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, C8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, C9: AnyType, O9: Value, E9: AnyType, A10: AnyType, B10: AnyType, C10: AnyType, O10: Value, E10: AnyType, A11: AnyType, B11: AnyType, C11: AnyType, O11: Value, E11: AnyType, A12: AnyType, B12: AnyType, C12: AnyType, O12: Value, E12: AnyType, // ](subjects: Tuple[S0, S1, S2], f0: def(A0, B0, C0) raises E0 thin -> O0, f1: def(A1, B1, C1) raises E1 thin -> O1, f2: def(A2, B2, C2) raises E2 thin -> O2, f3: def(A3, B3, C3) raises E3 thin -> O3, f4: def(A4, B4, C4) raises E4 thin -> O4, f5: def(A5, B5, C5) raises E5 thin -> O5, f6: def(A6, B6, C6) raises E6 thin -> O6, f7: def(A7, B7, C7) raises E7 thin -> O7, f8: def(A8, B8, C8) raises E8 thin -> O8, f9: def(A9, B9, C9) raises E9 thin -> O9, f10: def(A10, B10, C10) raises E10 thin -> O10, f11: def(A11, B11, C11) raises E11 thin -> O11, f12: def(A12, B12, C12) raises E12 thin -> O12) raises _Error13[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12] -> _Result13[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11, O12]
Match three subjects with 14 clauses.
def `match`[ S0: Movable, S1: Movable, S2: Movable, A0: AnyType, B0: AnyType, C0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, C1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, C2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, C3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, C4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, C5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, C6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, C7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, C8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, C9: AnyType, O9: Value, E9: AnyType, A10: AnyType, B10: AnyType, C10: AnyType, O10: Value, E10: AnyType, A11: AnyType, B11: AnyType, C11: AnyType, O11: Value, E11: AnyType, A12: AnyType, B12: AnyType, C12: AnyType, O12: Value, E12: AnyType, A13: AnyType, B13: AnyType, C13: AnyType, O13: Value, E13: AnyType, // ](subjects: Tuple[S0, S1, S2], f0: def(A0, B0, C0) raises E0 thin -> O0, f1: def(A1, B1, C1) raises E1 thin -> O1, f2: def(A2, B2, C2) raises E2 thin -> O2, f3: def(A3, B3, C3) raises E3 thin -> O3, f4: def(A4, B4, C4) raises E4 thin -> O4, f5: def(A5, B5, C5) raises E5 thin -> O5, f6: def(A6, B6, C6) raises E6 thin -> O6, f7: def(A7, B7, C7) raises E7 thin -> O7, f8: def(A8, B8, C8) raises E8 thin -> O8, f9: def(A9, B9, C9) raises E9 thin -> O9, f10: def(A10, B10, C10) raises E10 thin -> O10, f11: def(A11, B11, C11) raises E11 thin -> O11, f12: def(A12, B12, C12) raises E12 thin -> O12, f13: def(A13, B13, C13) raises E13 thin -> O13) raises _Error14[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13] -> _Result14[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11, O12, O13]
Match three subjects with 15 clauses.
def `match`[ S0: Movable, S1: Movable, S2: Movable, A0: AnyType, B0: AnyType, C0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, C1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, C2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, C3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, C4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, C5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, C6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, C7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, C8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, C9: AnyType, O9: Value, E9: AnyType, A10: AnyType, B10: AnyType, C10: AnyType, O10: Value, E10: AnyType, A11: AnyType, B11: AnyType, C11: AnyType, O11: Value, E11: AnyType, A12: AnyType, B12: AnyType, C12: AnyType, O12: Value, E12: AnyType, A13: AnyType, B13: AnyType, C13: AnyType, O13: Value, E13: AnyType, A14: AnyType, B14: AnyType, C14: AnyType, O14: Value, E14: AnyType, // ](subjects: Tuple[S0, S1, S2], f0: def(A0, B0, C0) raises E0 thin -> O0, f1: def(A1, B1, C1) raises E1 thin -> O1, f2: def(A2, B2, C2) raises E2 thin -> O2, f3: def(A3, B3, C3) raises E3 thin -> O3, f4: def(A4, B4, C4) raises E4 thin -> O4, f5: def(A5, B5, C5) raises E5 thin -> O5, f6: def(A6, B6, C6) raises E6 thin -> O6, f7: def(A7, B7, C7) raises E7 thin -> O7, f8: def(A8, B8, C8) raises E8 thin -> O8, f9: def(A9, B9, C9) raises E9 thin -> O9, f10: def(A10, B10, C10) raises E10 thin -> O10, f11: def(A11, B11, C11) raises E11 thin -> O11, f12: def(A12, B12, C12) raises E12 thin -> O12, f13: def(A13, B13, C13) raises E13 thin -> O13, f14: def(A14, B14, C14) raises E14 thin -> O14) raises _Error15[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13, E14] -> _Result15[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11, O12, O13, O14]
Match three subjects with 16 clauses.
def `match`[ S0: Movable, S1: Movable, S2: Movable, A0: AnyType, B0: AnyType, C0: AnyType, O0: Value, E0: AnyType, A1: AnyType, B1: AnyType, C1: AnyType, O1: Value, E1: AnyType, A2: AnyType, B2: AnyType, C2: AnyType, O2: Value, E2: AnyType, A3: AnyType, B3: AnyType, C3: AnyType, O3: Value, E3: AnyType, A4: AnyType, B4: AnyType, C4: AnyType, O4: Value, E4: AnyType, A5: AnyType, B5: AnyType, C5: AnyType, O5: Value, E5: AnyType, A6: AnyType, B6: AnyType, C6: AnyType, O6: Value, E6: AnyType, A7: AnyType, B7: AnyType, C7: AnyType, O7: Value, E7: AnyType, A8: AnyType, B8: AnyType, C8: AnyType, O8: Value, E8: AnyType, A9: AnyType, B9: AnyType, C9: AnyType, O9: Value, E9: AnyType, A10: AnyType, B10: AnyType, C10: AnyType, O10: Value, E10: AnyType, A11: AnyType, B11: AnyType, C11: AnyType, O11: Value, E11: AnyType, A12: AnyType, B12: AnyType, C12: AnyType, O12: Value, E12: AnyType, A13: AnyType, B13: AnyType, C13: AnyType, O13: Value, E13: AnyType, A14: AnyType, B14: AnyType, C14: AnyType, O14: Value, E14: AnyType, A15: AnyType, B15: AnyType, C15: AnyType, O15: Value, E15: AnyType, // ](subjects: Tuple[S0, S1, S2], f0: def(A0, B0, C0) raises E0 thin -> O0, f1: def(A1, B1, C1) raises E1 thin -> O1, f2: def(A2, B2, C2) raises E2 thin -> O2, f3: def(A3, B3, C3) raises E3 thin -> O3, f4: def(A4, B4, C4) raises E4 thin -> O4, f5: def(A5, B5, C5) raises E5 thin -> O5, f6: def(A6, B6, C6) raises E6 thin -> O6, f7: def(A7, B7, C7) raises E7 thin -> O7, f8: def(A8, B8, C8) raises E8 thin -> O8, f9: def(A9, B9, C9) raises E9 thin -> O9, f10: def(A10, B10, C10) raises E10 thin -> O10, f11: def(A11, B11, C11) raises E11 thin -> O11, f12: def(A12, B12, C12) raises E12 thin -> O12, f13: def(A13, B13, C13) raises E13 thin -> O13, f14: def(A14, B14, C14) raises E14 thin -> O14, f15: def(A15, B15, C15) raises E15 thin -> O15) raises _Error16[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13, E14, E15] -> _Result16[O0, O1, O2, O3, O4, O5, O6, O7, O8, O9, O10, O11, O12, O13, O14, O15]
rewrite¶
Source: fp/matching/matcher.mojo
def rewrite[ F: Data, A0: AnyType, O0: Value, E0: AnyType, // ](
subject: Node[F],
f0: def(A0) raises E0 thin -> O0,
) raises _Error1[E0] -> Node[F]
Rewrite subject bottom-up with clauses for the constructors that change.
A clause takes a constructor of F and returns the new Node[F]; its
recursive fields declared as Node[F] arrive already rewritten. Every other
node is rebuilt from its rewritten children, and a node whose children did not
change is reused, so sharing is preserved. A when clause may decline. The
rewrite is a single pass.
Parameters
F(Data, inferred): The data type.A0(AnyType, inferred): The clause's parameter type.O0(Value, inferred): The clause's result type:Node[F], or a guardedNode[F].E0(AnyType, inferred): The clause's error type,Neverfor a pure clause.
Arguments
subject(Node[F]): The value to rewrite.f0(def(A0) raises E0 thin -> O0): The first clause; further clauses follow in order.
Returns
Node[F]: The rewritten value.
Raises
The clauses' common error; a rewrite of pure clauses does not raise.
15 more overloads
Rewrite `subject` bottom-up with 2 clauses.
def rewrite[
F: Data, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1:
AnyType, //,
](
subject: Node[F],
f0: def(A0) raises E0 thin -> O0,
f1: def(A1) raises E1 thin -> O1,
) raises _Error2[E0, E1] -> Node[F]
Rewrite `subject` bottom-up with 3 clauses.
def rewrite[
F: Data, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1:
AnyType, A2: AnyType, O2: Value, E2: AnyType, //,
](
subject: Node[F],
f0: def(A0) raises E0 thin -> O0,
f1: def(A1) raises E1 thin -> O1,
f2: def(A2) raises E2 thin -> O2,
) raises _Error3[E0, E1, E2] -> Node[F]
Rewrite `subject` bottom-up with 4 clauses.
def rewrite[
F: Data, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1:
AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3:
AnyType, //,
](
subject: Node[F],
f0: def(A0) raises E0 thin -> O0,
f1: def(A1) raises E1 thin -> O1,
f2: def(A2) raises E2 thin -> O2,
f3: def(A3) raises E3 thin -> O3,
) raises _Error4[E0, E1, E2, E3] -> Node[F]
Rewrite `subject` bottom-up with 5 clauses.
def rewrite[
F: Data, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1:
AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3:
AnyType, A4: AnyType, O4: Value, E4: AnyType, //,
](
subject: Node[F],
f0: def(A0) raises E0 thin -> O0,
f1: def(A1) raises E1 thin -> O1,
f2: def(A2) raises E2 thin -> O2,
f3: def(A3) raises E3 thin -> O3,
f4: def(A4) raises E4 thin -> O4,
) raises _Error5[E0, E1, E2, E3, E4] -> Node[F]
Rewrite `subject` bottom-up with 6 clauses.
def rewrite[
F: Data, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1:
AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3:
AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5:
AnyType, //,
](
subject: Node[F],
f0: def(A0) raises E0 thin -> O0,
f1: def(A1) raises E1 thin -> O1,
f2: def(A2) raises E2 thin -> O2,
f3: def(A3) raises E3 thin -> O3,
f4: def(A4) raises E4 thin -> O4,
f5: def(A5) raises E5 thin -> O5,
) raises _Error6[E0, E1, E2, E3, E4, E5] -> Node[F]
Rewrite `subject` bottom-up with 7 clauses.
def rewrite[
F: Data, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1:
AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3:
AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5:
AnyType, A6: AnyType, O6: Value, E6: AnyType, //,
](
subject: Node[F],
f0: def(A0) raises E0 thin -> O0,
f1: def(A1) raises E1 thin -> O1,
f2: def(A2) raises E2 thin -> O2,
f3: def(A3) raises E3 thin -> O3,
f4: def(A4) raises E4 thin -> O4,
f5: def(A5) raises E5 thin -> O5,
f6: def(A6) raises E6 thin -> O6,
) raises _Error7[E0, E1, E2, E3, E4, E5, E6] -> Node[F]
Rewrite `subject` bottom-up with 8 clauses.
def rewrite[
F: Data, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1:
AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3:
AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5:
AnyType, A6: AnyType, O6: Value, E6: AnyType, A7: AnyType, O7: Value, E7:
AnyType, //,
](
subject: Node[F],
f0: def(A0) raises E0 thin -> O0,
f1: def(A1) raises E1 thin -> O1,
f2: def(A2) raises E2 thin -> O2,
f3: def(A3) raises E3 thin -> O3,
f4: def(A4) raises E4 thin -> O4,
f5: def(A5) raises E5 thin -> O5,
f6: def(A6) raises E6 thin -> O6,
f7: def(A7) raises E7 thin -> O7,
) raises _Error8[E0, E1, E2, E3, E4, E5, E6, E7] -> Node[F]
Rewrite `subject` bottom-up with 9 clauses.
def rewrite[
F: Data, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1:
AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3:
AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5:
AnyType, A6: AnyType, O6: Value, E6: AnyType, A7: AnyType, O7: Value, E7:
AnyType, A8: AnyType, O8: Value, E8: AnyType, //,
](
subject: Node[F],
f0: def(A0) raises E0 thin -> O0,
f1: def(A1) raises E1 thin -> O1,
f2: def(A2) raises E2 thin -> O2,
f3: def(A3) raises E3 thin -> O3,
f4: def(A4) raises E4 thin -> O4,
f5: def(A5) raises E5 thin -> O5,
f6: def(A6) raises E6 thin -> O6,
f7: def(A7) raises E7 thin -> O7,
f8: def(A8) raises E8 thin -> O8,
) raises _Error9[E0, E1, E2, E3, E4, E5, E6, E7, E8] -> Node[F]
Rewrite `subject` bottom-up with 10 clauses.
def rewrite[
F: Data, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1:
AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3:
AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5:
AnyType, A6: AnyType, O6: Value, E6: AnyType, A7: AnyType, O7: Value, E7:
AnyType, A8: AnyType, O8: Value, E8: AnyType, A9: AnyType, O9: Value, E9:
AnyType, //,
](
subject: Node[F],
f0: def(A0) raises E0 thin -> O0,
f1: def(A1) raises E1 thin -> O1,
f2: def(A2) raises E2 thin -> O2,
f3: def(A3) raises E3 thin -> O3,
f4: def(A4) raises E4 thin -> O4,
f5: def(A5) raises E5 thin -> O5,
f6: def(A6) raises E6 thin -> O6,
f7: def(A7) raises E7 thin -> O7,
f8: def(A8) raises E8 thin -> O8,
f9: def(A9) raises E9 thin -> O9,
) raises _Error10[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9] -> Node[F]
Rewrite `subject` bottom-up with 11 clauses.
def rewrite[
F: Data, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1:
AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3:
AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5:
AnyType, A6: AnyType, O6: Value, E6: AnyType, A7: AnyType, O7: Value, E7:
AnyType, A8: AnyType, O8: Value, E8: AnyType, A9: AnyType, O9: Value, E9:
AnyType, A10: AnyType, O10: Value, E10: AnyType, //,
](
subject: Node[F],
f0: def(A0) raises E0 thin -> O0,
f1: def(A1) raises E1 thin -> O1,
f2: def(A2) raises E2 thin -> O2,
f3: def(A3) raises E3 thin -> O3,
f4: def(A4) raises E4 thin -> O4,
f5: def(A5) raises E5 thin -> O5,
f6: def(A6) raises E6 thin -> O6,
f7: def(A7) raises E7 thin -> O7,
f8: def(A8) raises E8 thin -> O8,
f9: def(A9) raises E9 thin -> O9,
f10: def(A10) raises E10 thin -> O10,
) raises _Error11[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10] -> Node[F]
Rewrite `subject` bottom-up with 12 clauses.
def rewrite[
F: Data, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1:
AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3:
AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5:
AnyType, A6: AnyType, O6: Value, E6: AnyType, A7: AnyType, O7: Value, E7:
AnyType, A8: AnyType, O8: Value, E8: AnyType, A9: AnyType, O9: Value, E9:
AnyType, A10: AnyType, O10: Value, E10: AnyType, A11: AnyType, O11: Value,
E11: AnyType, //,
](
subject: Node[F],
f0: def(A0) raises E0 thin -> O0,
f1: def(A1) raises E1 thin -> O1,
f2: def(A2) raises E2 thin -> O2,
f3: def(A3) raises E3 thin -> O3,
f4: def(A4) raises E4 thin -> O4,
f5: def(A5) raises E5 thin -> O5,
f6: def(A6) raises E6 thin -> O6,
f7: def(A7) raises E7 thin -> O7,
f8: def(A8) raises E8 thin -> O8,
f9: def(A9) raises E9 thin -> O9,
f10: def(A10) raises E10 thin -> O10,
f11: def(A11) raises E11 thin -> O11,
) raises _Error12[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11] -> Node[F]
Rewrite `subject` bottom-up with 13 clauses.
def rewrite[
F: Data, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1:
AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3:
AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5:
AnyType, A6: AnyType, O6: Value, E6: AnyType, A7: AnyType, O7: Value, E7:
AnyType, A8: AnyType, O8: Value, E8: AnyType, A9: AnyType, O9: Value, E9:
AnyType, A10: AnyType, O10: Value, E10: AnyType, A11: AnyType, O11: Value,
E11: AnyType, A12: AnyType, O12: Value, E12: AnyType, //,
](
subject: Node[F],
f0: def(A0) raises E0 thin -> O0,
f1: def(A1) raises E1 thin -> O1,
f2: def(A2) raises E2 thin -> O2,
f3: def(A3) raises E3 thin -> O3,
f4: def(A4) raises E4 thin -> O4,
f5: def(A5) raises E5 thin -> O5,
f6: def(A6) raises E6 thin -> O6,
f7: def(A7) raises E7 thin -> O7,
f8: def(A8) raises E8 thin -> O8,
f9: def(A9) raises E9 thin -> O9,
f10: def(A10) raises E10 thin -> O10,
f11: def(A11) raises E11 thin -> O11,
f12: def(A12) raises E12 thin -> O12,
) raises _Error13[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12] -> Node[F]
Rewrite `subject` bottom-up with 14 clauses.
def rewrite[
F: Data, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1:
AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3:
AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5:
AnyType, A6: AnyType, O6: Value, E6: AnyType, A7: AnyType, O7: Value, E7:
AnyType, A8: AnyType, O8: Value, E8: AnyType, A9: AnyType, O9: Value, E9:
AnyType, A10: AnyType, O10: Value, E10: AnyType, A11: AnyType, O11: Value,
E11: AnyType, A12: AnyType, O12: Value, E12: AnyType, A13: AnyType, O13:
Value, E13: AnyType, //,
](
subject: Node[F],
f0: def(A0) raises E0 thin -> O0,
f1: def(A1) raises E1 thin -> O1,
f2: def(A2) raises E2 thin -> O2,
f3: def(A3) raises E3 thin -> O3,
f4: def(A4) raises E4 thin -> O4,
f5: def(A5) raises E5 thin -> O5,
f6: def(A6) raises E6 thin -> O6,
f7: def(A7) raises E7 thin -> O7,
f8: def(A8) raises E8 thin -> O8,
f9: def(A9) raises E9 thin -> O9,
f10: def(A10) raises E10 thin -> O10,
f11: def(A11) raises E11 thin -> O11,
f12: def(A12) raises E12 thin -> O12,
f13: def(A13) raises E13 thin -> O13,
) raises _Error14[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13] -> Node[F]
Rewrite `subject` bottom-up with 15 clauses.
def rewrite[
F: Data, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1:
AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3:
AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5:
AnyType, A6: AnyType, O6: Value, E6: AnyType, A7: AnyType, O7: Value, E7:
AnyType, A8: AnyType, O8: Value, E8: AnyType, A9: AnyType, O9: Value, E9:
AnyType, A10: AnyType, O10: Value, E10: AnyType, A11: AnyType, O11: Value,
E11: AnyType, A12: AnyType, O12: Value, E12: AnyType, A13: AnyType, O13:
Value, E13: AnyType, A14: AnyType, O14: Value, E14: AnyType, //,
](
subject: Node[F],
f0: def(A0) raises E0 thin -> O0,
f1: def(A1) raises E1 thin -> O1,
f2: def(A2) raises E2 thin -> O2,
f3: def(A3) raises E3 thin -> O3,
f4: def(A4) raises E4 thin -> O4,
f5: def(A5) raises E5 thin -> O5,
f6: def(A6) raises E6 thin -> O6,
f7: def(A7) raises E7 thin -> O7,
f8: def(A8) raises E8 thin -> O8,
f9: def(A9) raises E9 thin -> O9,
f10: def(A10) raises E10 thin -> O10,
f11: def(A11) raises E11 thin -> O11,
f12: def(A12) raises E12 thin -> O12,
f13: def(A13) raises E13 thin -> O13,
f14: def(A14) raises E14 thin -> O14,
) raises _Error15[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13, E14] -> Node[F]
Rewrite `subject` bottom-up with 16 clauses.
def rewrite[
F: Data, A0: AnyType, O0: Value, E0: AnyType, A1: AnyType, O1: Value, E1:
AnyType, A2: AnyType, O2: Value, E2: AnyType, A3: AnyType, O3: Value, E3:
AnyType, A4: AnyType, O4: Value, E4: AnyType, A5: AnyType, O5: Value, E5:
AnyType, A6: AnyType, O6: Value, E6: AnyType, A7: AnyType, O7: Value, E7:
AnyType, A8: AnyType, O8: Value, E8: AnyType, A9: AnyType, O9: Value, E9:
AnyType, A10: AnyType, O10: Value, E10: AnyType, A11: AnyType, O11: Value,
E11: AnyType, A12: AnyType, O12: Value, E12: AnyType, A13: AnyType, O13:
Value, E13: AnyType, A14: AnyType, O14: Value, E14: AnyType, A15: AnyType,
O15: Value, E15: AnyType, //,
](
subject: Node[F],
f0: def(A0) raises E0 thin -> O0,
f1: def(A1) raises E1 thin -> O1,
f2: def(A2) raises E2 thin -> O2,
f3: def(A3) raises E3 thin -> O3,
f4: def(A4) raises E4 thin -> O4,
f5: def(A5) raises E5 thin -> O5,
f6: def(A6) raises E6 thin -> O6,
f7: def(A7) raises E7 thin -> O7,
f8: def(A8) raises E8 thin -> O8,
f9: def(A9) raises E9 thin -> O9,
f10: def(A10) raises E10 thin -> O10,
f11: def(A11) raises E11 thin -> O11,
f12: def(A12) raises E12 thin -> O12,
f13: def(A13) raises E13 thin -> O13,
f14: def(A14) raises E14 thin -> O14,
f15: def(A15) raises E15 thin -> O15,
) raises _Error16[E0, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13, E14, E15] -> Node[F]
when¶
Source: fp/matching/clauses.mojo
def when[
A: AnyType, O: Value, EG: AnyType, EB: AnyType, //, guard: def(A) raises EG
thin -> Bool, clause: def(A) raises EB thin -> O,
](
a: A,
) raises _CommonError[_NativeError[EG], _NativeError[EB]] -> Guarded[O]
A clause that applies only when guard holds for the same argument.
When the guard returns False the match tries the next clause for the same
constructor, so a constructor still needs a clause that cannot decline.
Literal and nested patterns are written as guards: e.left == Literal(0).
Parameters
A(AnyType, inferred): The clause's parameter type: a constructor of the matched data type.O(Value, inferred): The clause's result type, orNext.EG(AnyType, inferred): The guard's error type,Neverfor a pure guard.EB(AnyType, inferred): The clause's error type,Neverfor a pure clause.guard(def(A) raises EG thin -> Bool): Decides whether the clause applies.clause(def(A) raises EB thin -> O): The clause to apply.
Arguments
a(A): The constructor being matched.
Returns
Guarded[O]: The clause's result, or nothing when the guard does not hold.
Raises
The guard's or the clause's error, unchanged; both must raise one type or Never.
def when[
A: AnyType, B: AnyType, O: Value, EG: AnyType, EB: AnyType, //, guard:
def(A, B) raises EG thin -> Bool, clause: def(A, B) raises EB thin -> O,
](
a: A,
b: B,
) raises _CommonError[_NativeError[EG], _NativeError[EB]] -> Guarded[O]
A guarded clause with two parameters: a constructor and the context, or two subjects.
Parameters
A(AnyType, inferred): The first parameter type.B(AnyType, inferred): The second parameter type.O(Value, inferred): The clause's result type, orNext.EG(AnyType, inferred): The guard's error type,Neverfor a pure guard.EB(AnyType, inferred): The clause's error type,Neverfor a pure clause.guard(def(A, B) raises EG thin -> Bool): Decides whether the clause applies.clause(def(A, B) raises EB thin -> O): The clause to apply.
Arguments
a(A): The first argument.b(B): The second argument.
Returns
Guarded[O]: The clause's result, or nothing when the guard does not hold.
Raises
The guard's or the clause's error, unchanged; both must raise one type or Never.
def when[
A: AnyType, B: AnyType, C: AnyType, O: Value, EG: AnyType, EB: AnyType, //,
guard: def(A, B, C) raises EG thin -> Bool, clause: def(A, B, C) raises EB
thin -> O,
](
a: A,
b: B,
c: C,
) raises _CommonError[_NativeError[EG], _NativeError[EB]] -> Guarded[O]
A guarded clause with three parameters, for three subjects.
Parameters
A(AnyType, inferred): The first parameter type.B(AnyType, inferred): The second parameter type.C(AnyType, inferred): The third parameter type.O(Value, inferred): The clause's result type.EG(AnyType, inferred): The guard's error type,Neverfor a pure guard.EB(AnyType, inferred): The clause's error type,Neverfor a pure clause.guard(def(A, B, C) raises EG thin -> Bool): Decides whether the clause applies.clause(def(A, B, C) raises EB thin -> O): The clause to apply.
Arguments
a(A): The first argument.b(B): The second argument.c(C): The third argument.
Returns
Guarded[O]: The clause's result, or nothing when the guard does not hold.
Raises
The guard's or the clause's error, unchanged; both must raise one type or Never.
Structs¶
Guarded¶
Source: fp/matching/clauses.mojo
struct Guarded[O: Value](Movable, _Declinable)
The result of a when clause: a value when its guard held, nothing otherwise.
Parameters
O(Value): The clause's result type, orNext.
Implements
_Declinable
Aliases
Payload
Guarded.accepted¶
def accepted(self) -> Bool
Whether the guard held.
Returns
Bool: True when the clause applied and produced a result.
Guarded.take¶
def take(deinit self) -> O
The clause's result; the guard must have held.
Returns
O: The result the clause produced.
Next¶
Source: fp/matching/clauses.mojo
struct Next[N: ImplicitlyCopyable & Deinitable](Movable, _Continuation)
The result of the matched value is the result of matching node instead.
node must be smaller than the matched value: a sub-value, or any value of
smaller height. Continuing with a value that is not smaller aborts, so a
chain of Next steps always ends.
Parameters
N(ImplicitlyCopyable & Deinitable): The value type,Node[F]for the data type being matched.
Implements
_Continuation
Fields
node(N): The value to match next.
Evaluate, render and rewrite a recursive type¶
"""A recursive expression type: evaluate, render and simplify it with clauses.
Each clause handles one constructor. A field declared with the result type
arrives already evaluated; a field declared as `Expr` arrives as it is. `If`
continues with the branch it takes, so the other branch is never evaluated.
"""
import fp
from fp.adt import Data, Cases, Node, Value
from fp.matching import Next
@fieldwise_init
struct Num(Copyable, Equatable):
var value: Int
@fieldwise_init
struct Add[R: Value](Movable):
var left: Self.R
var right: Self.R
@fieldwise_init
struct Mul[R: Value](Movable):
var left: Self.R
var right: Self.R
@fieldwise_init
struct If[C: Value, B: Value](Movable):
var cond: Self.C
var then: Self.B
var other: Self.B
struct Expr(Data):
comptime Layer[R: Value] = Cases[Num, Add[R], Mul[R], If[R, R]]
comptime E = Node[Expr]
def evaluate(e: E) -> Int:
return fp.match(e,
lambda (n: Num) -> Int: n.value,
lambda (a: Add[Int]) -> Int: a.left + a.right,
lambda (m: Mul[Int]) -> Int: m.left * m.right,
lambda (c: If[Int, E]) -> Next[E]: Next(c.then if c.cond != 0 else c.other))
def render(e: E) -> String:
return fp.match(e,
lambda (n: Num) -> String: String(n.value),
lambda (a: Add[String]) -> String: "(" + a.left + " + " + a.right + ")",
lambda (m: Mul[String]) -> String: m.left + " * " + m.right,
lambda (c: If[String, String]) -> String: "if " + c.cond + " then " + c.then + " else " + c.other)
def simplify(e: E) -> E:
"""Remove additions of zero and multiplications by one, bottom-up."""
return fp.rewrite(e,
fp.when[lambda (a: Add[E]) -> Bool: a.left == Num(0), lambda (a: Add[E]) -> E: a.right],
fp.when[lambda (a: Add[E]) -> Bool: a.right == Num(0), lambda (a: Add[E]) -> E: a.left],
fp.when[lambda (m: Mul[E]) -> Bool: m.left == Num(1), lambda (m: Mul[E]) -> E: m.right],
fp.when[lambda (m: Mul[E]) -> Bool: m.right == Num(1), lambda (m: Mul[E]) -> E: m.left])
def main():
var zero: E = Num(0)
var one: E = Num(1)
var x: E = Add(E(Mul(one, E(Num(6)))), E(Add(E(Num(4)), zero)))
print(render(x), "=", evaluate(x))
var y = simplify(x)
print(render(y), "=", evaluate(y))
# The branch not taken is never evaluated, however large it is.
var big: E = one
for _ in range(40):
big = Mul(big, big)
print(evaluate(E(If(zero, big, E(Num(7))))))
# A value shared by both operands is evaluated once per match.
var shared: E = Num(2)
for _ in range(61):
shared = Add(shared, shared)
print(evaluate(shared))
# Depth is limited only by memory.
var deep: E = zero
for _ in range(1_000_000):
deep = Add(deep, one)
print(evaluate(deep))
Run from the repository root pixi run mojo run -I src docs/examples/expression.mojo
Output
(1 * 6 + (4 + 0)) = 10
(6 + 4) = 10
7
4611686018427387904
1000000
evaluate asks for the fields of Add and Mul evaluated and returns 10 for
Add(Mul(1, 6), Add(4, 0)). Its If clause returns Next with the chosen
branch, so If(zero, big, 7) returns 7 without evaluating big. simplify
uses fp.rewrite with guarded clauses and returns (6 + 4). The last two
matches evaluate a value built from 61 doublings of one shared node, and a value
a million levels deep.
Match several values at once¶
"""Matching several values together: a light's next state for an event, and a third plain value."""
import fp
from fp.adt import Data, Cases, Node, Value
@fieldwise_init
struct Red(Copyable):
pass
@fieldwise_init
struct Green(Copyable):
pass
@fieldwise_init
struct Amber(Copyable):
pass
struct Light(Data):
comptime Layer[R: Value] = Cases[Red, Green, Amber]
@fieldwise_init
struct Tick(Copyable):
pass
@fieldwise_init
struct Outage(Copyable):
var code: Int
struct Event(Data):
comptime Layer[R: Value] = Cases[Tick, Outage]
comptime L = Node[Light]
comptime V = Node[Event]
def step(light: L, event: V) -> L:
return fp.match((light, event),
lambda (s: Red, e: Tick) -> L: Green(),
lambda (s: Green, e: Tick) -> L: Amber(),
lambda (s: Amber, e: Tick) -> L: Red(),
lambda (s: L, e: Outage) -> L: Red())
def name(light: L) -> String:
return fp.match(light,
lambda (r: Red) -> String: "red",
lambda (g: Green) -> String: "green",
lambda (a: Amber) -> String: "amber")
def report(light: L, event: V, waiting: Int) -> String:
"""A plain third value takes part in guards like the others."""
return fp.match((light, event, waiting),
fp.when[lambda (s: Red, e: Tick, n: Int) -> Bool: n > 3,
lambda (s: Red, e: Tick, n: Int) -> String: "red with a queue of " + String(n)],
lambda (s: L, e: Outage, n: Int) -> String: "outage " + String(e.code),
lambda (s: L, e: V, n: Int) -> String: "normal")
def main():
var light: L = Red()
var tick: V = Tick()
for _ in range(4):
light = step(light, tick)
print(name(light))
print(name(step(light, V(Outage(7)))))
print(report(L(Red()), tick, 5), "|", report(light, V(Outage(7)), 0), "|", report(light, tick, 0))
Run from the repository root pixi run mojo run -I src docs/examples/traffic_light.mojo
Output
green
amber
red
green
red
red with a queue of 5 | outage 7 | normal
step matches a light and an event together, so its clauses cover every pair
of constructors; four ticks from red give green, amber, red and green.
report adds a plain Int as a third value, and its guard n > 3 selects
"red with a queue of 5".