Skip to content

Latest commit

 

History

History
39 lines (28 loc) · 562 Bytes

5015.md

File metadata and controls

39 lines (28 loc) · 562 Bytes

5015

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 *)

To fix

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