February 18, 2026
Type wars: hold my generics
How to Choose Between Hindley-Milner and Bidirectional Typing
Dev world split: “Do you need generics?” vs “Forget HM” — plus one guy built a language anyway
TLDR: The article says the real choice isn’t HM vs bidirectional—it’s whether your language needs generics, and bidirectional can include the same tools anyway. Comments erupted: some say add subtyping and ditch HM, others want clearer error messages, and one dev built a language without knowing either term.
The blog How to Choose Between Hindley-Milner and Bidirectional Typing throws a grenade into a nerdy feud: stop asking “HM vs Bidirectional,” ask “Does your language need generics?” (think reusable templates). If yes, you probably need “unification” (the system’s way of matching things), and surprise — bidirectional typing can use it too. Translation: this isn’t a rivalry; bidirectional is basically the bigger toolbox.
Cue the comments. One user, kccqzy, stormed in with the hottest take: you also need to ask about subtyping (like class inheritance). If your answer is yes to both generics and subtyping, “forget Hindley-Milner.” The HM fans clutched their pearls while pragmatists screamed “preach.” Meanwhile, gergoerdi dropped a link and a mic: try a “compositional type system” for clearer error messages — the crowd rallied around the promise of errors that humans can actually read.
Humor kept pace with the brainy brawl. piinbinary riffed on the line about “friends don’t bring up type inference at brunch,” nodding to a meme about people not randomly recommending operating systems. And then came the chaos cameo: Panzerschrek confessed they built an “advanced” language but don’t know what HM or bidirectional even are. Half the thread saluted the hustle, half questioned reality. Verdict? Pick features first, then the type system — and try not to start a flame war at brunch.
Key Points
- •The article argues that choosing between HM and bidirectional typing is a false dichotomy and should be reframed around language needs.
- •Determining whether a language needs generics is pivotal, as generics generally require unification.
- •Unification is central to Hindley–Milner; selecting HM entails using unification.
- •Bidirectional typing can operate without unification via annotations, yet can also incorporate unification and support HM features.
- •An HM-style infer function over an AST and types is sketched, and Rust’s Vec inference is cited to illustrate unification.