Esqueleto Tutorial

Haskell crowd goes wild over Esqueleto: safer queries or “just write SQL”

TLDR: Esqueleto’s new, safer way to write database queries in Haskell is now the default, and this tutorial shows how to use it. Comments split between fans of compiler-checked queries and skeptics who want plain SQL, with jokes about 3AM pagers and a five-year wait.

The Esqueleto tutorial dropped, and the comments went nuclear. In simple terms: it shows how developers using Haskell can ask questions of a database with Esqueleto, a tool that looks like regular SQL (the language for talking to databases) but checks your work before the program runs. The big news: a clearer “new style” for building queries just became the default after a five-year phase-out of the old way. Fans cheered the promise of fewer 3AM emergencies, chanting the mantra “follow the types”—let the computer catch mistakes so you don’t have to.

Then came the backlash. The type-safety faithful called it guardrails; the SQL purists called it training wheels. One commenter groaned, “This reads like a wizard spell,” while others swooned over the new syntax as “actually readable.” The community split on whether Esqueleto makes simple tasks feel heavy, or simply keeps teams honest. Memes flew: “If it compiles, my pager sleeps,” “Five-year deprecation = Haskell time,” and a viral GIF of a knight labeled “Compiler” swatting bugs. Pragmatists landed in the middle: use basic tools for easy stuff, bring Esqueleto for the complicated queries, and yes—let the compiler babysit.

Key Points

  • Persistent handles basic database operations in Haskell; complex queries use Esqueleto.
  • Esqueleto provides near-raw SQL expressiveness with compile-time type safety.
  • A new from-clause syntax via Database.Esqueleto.Experimental became the default after a five-year deprecation of the old style.
  • The tutorial advocates learning Esqueleto by translating standard SQL exercises and following type guidance.
  • An example demonstrates a join-and-aggregate SQL query and its equivalent in both new and old Esqueleto styles.

Hottest takes

"If my code compiles, my pager sleeps" — nighthawk_dev
"This reads like a wizard spell, not a query" — sqlPurist
"Five-year deprecation? That’s geologic time" — timeboxed
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.