fram-lang/dbl

Pretty-print infix constructors in pattern counterexamples using infix notation

Open

#325 opened on Feb 21, 2026

View on GitHub
 (0 comments) (0 reactions) (0 assignees)OCaml (28 forks)auto 404
error messagesgood first issue

Repository metrics

Stars
 (46 stars)
PR merge metrics
 (PR metrics pending)

Description

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

Contributor guide