Esqueleto Tutorial
2 days ago
- #Haskell
- #Database
- #Esqueleto
- Persistent is used in Haskell for basic database operations, while Esqueleto allows for more complex, type-safe SQL queries.
- Esqueleto's new style syntax is safer and more sensible, becoming the default after a deprecation period of the legacy style.
- The tutorial demonstrates setting up a sandbox with Esqueleto, including connecting to a SQLite database and performing basic queries.
- Basic query operations include selecting arithmetic expressions, multiple values, and records from tables with sorting and limiting.
- Filtering data involves using `where_` clauses, string matching with `like`, combining conditions, and checking for set inclusion or nullity.
- Joins are a powerful feature in Esqueleto, allowing for cross-referencing tables with inner joins and combining multiple tables in queries.
- Aggregation functions like `count` and `groupBy` enable summarizing data, with `having` clauses for filtering grouped results.
- The tutorial emphasizes learning Esqueleto by translating SQL queries into Haskell, leveraging type safety and compiler feedback.