The left-hand side of an as
pattern was neither a name nor a typed name.
fun f x =
case x of
3 as y => y
(** ^ left-hand side of `as` pattern must be a name *)
| _ => x
The syntax for as
patterns is <name> (: <ty>)? as <pat>
.
Ensure the left hand side of the as
is either a name or a typed name.
fun f x =
case x of
y as 3 => y
| _ => x