Skip to content

Pretty-print infix constructors in pattern counterexamples using infix notation #325

Description

@rureirureirurei

Pretty-print infix constructors in pattern counterexamples using infix notation

When pattern matching is non-exhaustive, the compiler shows a counterexample. Currently, infix constructors like :: are printed in prefix notation with excessive parentheses:

fatal error: This pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
  (::) _ ((::) _ _)

This should be printed as:

  _ :: _ :: _

Details

  • Infix constructors are stored internally as "(::)" (parentheses-wrapped)
  • Precedence is determined by first character (: -> level 70, + -> 80, * -> 90, etc.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    error messagesImproving error messages provided to the programmergood first issueGood for newcomers

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions