r/Compilers • • 17h ago

Haze Programming Language

https://www.haze-lang.cc/
0 Upvotes

43 comments sorted by

View all comments

2

u/AustinVelonaut 13h ago

Looking at the documentation, I see that Haze supports pattern matching, but doesn't support nested patterns. Is there a reason why those are disallowed? They can provide succinct expressions for things like balancing red-black trees:

balanceLeft (Node _ (Node Red lx kx vx rx) ky vy ry) k v r = Node Red (Node Black lx kx vx rx) ky vy (Node Black ry k v r)

0

u/Top_Marionberry_4413 13h ago

nesting can get messy quickly.

not unplanned though, these kind of FP features are generally desirable if they have guardrails.

1

u/AustinVelonaut 13h ago

If you add them, there's a nice match algorithm in The Implementation of Functional Programming Languages that converts a nested pattern match into a fairly-optimal case-tree.