A minimalistic general high level API for relational databases


Version on this page:0.4.1
LTS Haskell 22.26:
Stackage Nightly 2024-06-22:
Latest on Hackage:1.8

See all snapshots hasql appears in

MIT licensed and maintained by Nikita Volkov
This version can be pinned in stack with:hasql-0.4.1@sha256:411498a83a74a36e1d91dc2f5e22f66707d2ccfd9bb39ebc1857fbd04b723cd5,6037

Module documentation for 0.4.1

  • Hasql

A robust and concise yet powerful API for communication with arbitrary relational databases using SQL.


  • Concise and crisp API. Just a few functions and two monads doing all the boilerplate job for you.

  • A powerful transaction abstraction, which provides an automated resolution of conflicts. The API ensures that you're only able to perform a specific set of actions in the transaction context, which allows Hasql to safely resolve conflicting transactions by automatically retrying them. This is much inspired by STM and ST.

  • Support for cursors. Allows to fetch virtually limitless result sets in a constant memory using streaming.

  • Employment of prepared statements. Every statement you emit gets prepared and cached. This raises the performance of the backend.

  • Automated management of resources related to connections, transactions and cursors.

  • A built-in connections pool.

  • Compile-time generation of templates. You just can't write a statement with an incorrect number of placeholders.

  • Ability to map to any types actually supported by the backend.




  • Fix the transaction conflicts bug