You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HVM's runtime only handles direct, non nested matches. So, for example, this is a valid rule:
(Foo (Bar xs)) = (A xs)
But this is not:
(Foo (Bar (Cons x xs))) = (A (Cons x xs))
Because there is a nested match. In order for these cases to work, we must split the left-hand of nested patterns, into many non nested equations. Currently, the language has a flattener that is limited, and will fail in some cases. For example, the function below:
Fn (Bar (Cons ...)) = A
Fn (Bar Nil) = B
Fn x = C
Should be compiled to:
Fn (Bar _0) = (Fn.0 _0)
(Fn.0 (Cons x y)) = A
(Fn.0 Nil) = B
(Fn.0 x) = C
Fn x = C
But the current flattener can't deal with that.
The text was updated successfully, but these errors were encountered:
The method for doing this is described in chapter five "Efficient compilation of Pattern-Matching" by Wadler in "The Implementation of Functional Programming Languages" (1987) by Simon L Peyton-Jones
HVM's runtime only handles direct, non nested matches. So, for example, this is a valid rule:
But this is not:
Because there is a nested match. In order for these cases to work, we must split the left-hand of nested patterns, into many non nested equations. Currently, the language has a flattener that is limited, and will fail in some cases. For example, the function below:
Should be compiled to:
But the current flattener can't deal with that.
The text was updated successfully, but these errors were encountered: