What databases do you find the most productive to connect to Haskell?

This page summarizes the projects mentioned and recommended in the original post on /r/haskell

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • esqueleto

    Bare bones, type-safe EDSL for SQL queries on persistent backends. (by prowdsponsor)

  • Postgresql-simple is a great library, it makes a nice use of overloaded strings to do the job. Some other nice libraries to keep an eye on are opaleye (postgres specific, which is equally nice but could be a bit difficult to get why the types are so big) and a combination of persistent (not DB specific! can work on postgres, sqlite, but also noSQL DBs like mongo, it's still easy to learn but you lose some things, such as joins due to the power of being agnostic) + esqueleto for type safe joins (be sure to look up the experimental package, it's a more comfortable syntax that will soon become the default one).

  • bayes-hs

  • I wanted something simple for my pet project, and I loved working with sqlite-simple. But I decided to wrap it into ReaderT, so I wouldn't have to pass connection everywhere. Like this: https://github.com/sudo97/bayes-hs/blob/main/src/DBWork.hs

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • postgresql-typed

    Haskell PostgreSQL library with compile-time type inference

  • If you need Cassandra specifically, cql-io is pretty good. For a general purpose database I'd go with Postgres. There are many good choices in the Haskell ecosystem, but I really like postgres-typed. It lets you write plain SQL, checks you queries against a live database schema at compile time, and makes sure you use the results correctly as well. It's amazing, I never ran into type related errors and it's pretty seamless.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts