Boost your command-line applications with potions! by Eric Torreborre

April 16, 2025

In his presentation Boost your command-line applications with potions!, Eric Torreborre explores the functional programming language Unison and its innovative command-line parsing library called potions. He addresses the challenges of standardizing command-line argument parsing across various programming languages and emphasizes the necessity of effective help documentation. Eric introduces Unison’s unique features, including immutable code, hash identifiers for functions, and an effect system, which collectively enhances the development and deployment processes. He demonstrates how to build a well-typed copy command and explains various argument parsing capabilities, including flags, options, and error handling. Throughout the talk, he stresses the advantages of structured data types for command-line options, the flexibility of using a domain-specific language (DSL), and the need for effective parsing with comprehensive help documentation. Despite the strengths of Unison, such as its functional programming benefits, Eric also shares challenges related to code navigation and readability, advocating for improvements to enhance the development experience, particularly in the context of working with microservices and cloud applications.

Boost Your Command-Line Applications with Potions!: A comprehensive overview

Why another CLI library?

Eric Torreborre starts by pointing out the chaos of terminology: some languages talk about “flags”, others about “options”, and standards for help output are all over the place. His goal with Potions (an anagram of “options”, fittingly) was to create a consistent, expressive system for command-line parsing — one that could even generate great help documentation automatically.

And he doesn’t just stop at parsing: Potions includes nice visual touches like colored terminal output to make CLI apps more inviting.

 

Meet Unison: A different kind of programming language

At the heart of Potions is Unison, a functional language with a few radical ideas:

  • Immutable code: Code isn’t stored in text files, but in a database keyed by hashes.
  • Safe upgrades: Updating a function doesn’t break your project — you can version things cleanly.
  • Abilities: A unique effect system that lets you handle IO, randomness, state, and more in a structured way.

Eric walks through Unison basics — like type signatures, pattern matching, and abilities — showing how it provides a great foundation for building reliable, highly typed applications like Potions.

 

What makes Potions special?

Eric carefully designed Potions with a few key goals in mind:

  • First-class help documentation: Examples and documentation live with the code, and can even be executable.
  • Flexible parsing: Flags, options, positional arguments, environment variable inputs — all well-supported.
  • Type safety: Parsers are fully typed, catching errors before they reach users.
  • Composable parsers: Build complex commands from simpler parts using combinators.
  • Structured errors and suggestions: Inspired by Rust, Potions can suggest corrections when users mistype commands.

The result? CLI apps that are easier to build, safer to run, and friendlier to users.

 

How it works under the hood

Eric dives into some of the architecture behind Potions:

  • Unified data nodel: Even though options, flags, and arguments are different, they’re all treated as variations on a common option type.
  • Builder pattern: Options are first described, then instantiated after parsing — allowing better validation and help generation.
  • Effect handling: Parsing, validation, and help generation all use Unison’s abilities for clean separation of concerns.

He even touches on the design of error messages, noting that a good parser should not just fail but help the user fix mistakes.

 

The good (and the frustrating) parts of Unison

While Unison’s model is powerful, Eric also shares some real-world frustrations:

  • Limited tooling: Navigation between definitions is clunky, and automatic formatting can hurt readability.
  • Slow feedback loops: Type errors accumulate and can make debugging harder.
  • Workspace quirks: Managing updates and conflicts is trickier than in traditional text-based environments.

That said, Eric remains optimistic: the Unison team is actively working on improvements, especially around the developer experience for cloud and microservices deployment.

 

A Functional Programming journey

Eric closes by sharing his personal story: a journey from frustration with imperative languages (C++, Java) through discovery of Scala, Haskell, and now Unison. Functional programming, he argues, offers better ways to reason about complex systems — especially when correctness and concurrency are involved.

Today, Eric works at Okam, developing secure communication software using Rust and Elixir — but his love for functional principles continues to guide his approach to building robust systems.

 

Takeaway:
Potions shows that even something as “simple” as parsing command-line options can be reimagined with strong typing, composability, and a better user experience. And Unison offers a glimpse into a future where code is not just written but managed more safely at every level.

 

Additional resources

Check out more from the MeetUp Func Prog Sweden. Func Prog Sweden is the community for anyone interested in functional programming. At the MeetUps the community explore different functional languages like Erlang, Elixir, Haskell, Scala, Clojure, OCaml, F# and more.