A constructor had no argument in a pattern match, but it was defined to have an argument in the datatype
.
datatype d = A | B of int
fun f x =
case x of
A => 1
| B => 2
(** ^ missing argument for constructor pattern *)
Try one of the following:
-
Add an argument to the pattern:
datatype d = A | B of int fun f x = case x of A => 1 | B _ => 2
-
Define the constructor to not have an argument:
datatype d = A | B fun f x = case x of A => 1 | B => 2