Optique 0.7.0: Smarter error messages and validation library integrations

https://hackers.pub/@hongminhee/2025/optique-070

Optique 0.7.0: Smarter error messages and validation library integrations

Optique 0.7.0 introduces enhancements focused on improving the developer experience and expanding its ecosystem for type-safe CLI argument parsing in TypeScript. This release brings automatic "Did you mean?" suggestions to help users correct typos, along with seamless integrations for Zod and Valibot validation libraries, ensuring more robust and efficient CLI development. Duplicate option name detection is now included to catch configuration bugs early, and context-aware error messages provide users with precise feedback. The update also features customizable shell completion naming conventions and improved line break handling in error messages. With these new features, Optique aims to streamline CLI development in TypeScript, making it more intuitive and less error-prone. This release underscores Optique's commitment to providing developers with powerful tools for building high-quality CLI applications.

Hackers' Pub

Optique 0.5.0: Enhanced error handling and message customization

https://hackers.pub/@hongminhee/2025/optique-050

Optique 0.5.0: Enhanced error handling and message customization

Optique 0.5.0 is now available, bringing enhancements to error handling, help text generation, and overall developer experience while maintaining full backward compatibility. The update introduces better code organization by refactoring the large `@optique/core/parser` module into three focused modules: `@optique/core/primitives`, `@optique/core/modifiers`, and `@optique/core/constructs`. Error handling is improved with automatic conversion of default value callback errors into parser-level errors, and the new `WithDefaultError` class allows for structured error messages. Customization of default values in help text is now possible via an optional third parameter to `withDefault()`, enabling descriptive text instead of actual values. Additionally, the release provides comprehensive error message customization across all parser types and combinators, allowing context-specific feedback. These improvements aim to make Optique more user-friendly, especially for building CLI applications that require clear error messages and helpful documentation, making this release a significant step forward for developers using Optique.

Hackers' Pub
Stop writing CLI validation. Parse it right the first time.

This post introduces Optique, a new library created to address the pervasive problem of repetitive and often messy validation code in CLI tools. The author was motivated by the observation that nearly every CLI tool reinvents the wheel with similar validation patterns for dependent options, mutually exclusive options, and environment-specific requirements. Optique leverages parser combinators and TypeScript's type inference to ensure that CLI arguments are parsed directly into valid configurations, eliminating the need for manual validation. By describing the desired CLI configuration with Optique, TypeScript automatically infers the types and constraints, catching potential bugs at compile time. The author shares their experience of deleting large chunks of validation code and simplifying refactoring tasks. Optique aims to provide a more robust and maintainable approach to CLI argument parsing, potentially saving developers from writing the same validation logic repeatedly.

Hackers' Pub

I like Swift-parsing.
Winnow(Rust) > Swift-paring >> ParserCombinator.jl(Julia)

#parsercombinators

Parser combinators in #Haskell are like the cool kids at school 🎓, effortlessly solving Advent of Code problems while #regexes are stuck in detention 🚫. Who knew regexes were still a thing in 2025? 😂 In Haskell, we leave those relics to flounder in the past while we flex our combinator muscles 💪.
https://entropicthoughts.com/parser-combinators-beat-regexes #ParserCombinators #AdventOfCode #FutureCoding #Flexibility #HackerNews #ngated
Parser Combinators Beat Regexes

Parser Combinators Beat Regexes

Context free grammars (CFG) are better than parsing expression grammars (PEG), because CFGs represent how we think.

Parser combinators are similar to PEGs, so they are worse than CFGs, too.

So, don't use Rust libraries nom, combine. Use lalrpop.

Don't use Haskell libraries parsec, gigaparsec, attoparsec, megaparsec, trifecta. Use Earley, happy.

See more detailed story in my new article https://safinaskar.writeas.com/this-is-why-you-should-never-use-parser-combinators-and-peg .

The story also includes some cases, where PEG and parser combinators may still be useful. Also, the article gives links to my Haskell parsing libraries.

#haskell #rust #parsing #parse #cfg #peg #combinators #parsercombinators #parsingcombinators #nom #combine #lalrpop #parsec #earley #happy

This is why you should never use parser combinators and PEG

Let me tell you why you should (nearly) never use PEG (parsing expression grammars). Nearly everything I will say applies to parser combi...

Askar Safin

This talk I gave on parser combinators is (just) over a decade old now and it's kinda neat to see people still link to it, even people writing about parsers in other languages...

https://www.youtube.com/watch?v=r_Enynu_TV0

#ParserCombinators

Parsing Stuff in Haskell

YouTube