hasql-th
hasql-dynamic-statements
Our great sponsors
hasql-th | hasql-dynamic-statements | |
---|---|---|
4 | 1 | |
109 | 5 | |
- | - | |
5.2 | 0.0 | |
4 months ago | over 1 year ago | |
Haskell | Haskell | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
hasql-th
-
How to use PostgreSQL with Haskell: hasql
Hasql is an ecosystem of libraries. To keep it simple, let’s limit ourselves to core hasql, hasql-transaction, and hasql-th. We’re using hasql 1.6.3.2 published in 2023.
- Parsing SQL
-
Open Source SQL Parsers
There is also a Haskell port of the original PostgreSQL parser, implemented using megaparsec, which makes it highly flexible and hackable: https://github.com/nikita-volkov/hasql-th#implementation
-
Haskell doesn't make sense without pure functions
I'd consider hasql-th a good example in what concerns databases. Otherwise, I just use aeson together with deriving-aeson and lens-aeson.
hasql-dynamic-statements
-
Persistent vs. beam for production database
In typical CRUD applications you can get a long way with type-checked plain SQL and tuples via hasql-th, which is a great time saver at prototyping. Later on when you have more conditional logic in your queries you can gradually substitute it with dynamic statements. It works very well in production where you incrementally refine your own high-level abstractions with appropriate encoders/decoders, you can even build your own DSL on top of it, instead of relying on pre-defined query building APIs of Persistent and Beam. But again, both Persistent and Beam will work well too.
What are some alternatives?
Neks - A dead simple networked key/value store
hasql - The fastest PostgreSQL libpq-based driver for Haskell
tokyocabinet-haskell - This repository will get archived soon. Please visit https://git.singpolyma.net/tokyocabinet-haskell
wai-middleware-cache-redis - Redis backend for wai-middleware-cache
ampersand - Build database applications faster than anyone else, and keep your data pollution free as a bonus.
hasql-notifications - Use PostgreSQL LISTEN/NOTIFY with your Hasql Types
hasql-transaction - A composable abstraction over retriable transactions for Hasql
hasql-cursor-query - A declarative abstraction over PostgreSQL Cursor
logging-effect - A very general logging effect for Haskell
aeson-json-ast - Integration layer for "json-ast" and "aeson"
ether - Monad Transformers and Classes
hworker - A reliable at-least-once job queue built on Redis.