Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. OCaml
  3. Macaque

Macaque

NOASSERTIONOCaml0.7.4

A DSL for safe and composable SQL queries in OCaml using comprehensions and expressive types, built on PG'OCaml.

GitHubGitHub
40 stars11 forks0 contributors

Overview

Macaque is a domain-specific language (DSL) for constructing SQL queries in OCaml, designed to provide type safety and compositional flexibility. It enables developers to write database queries using a comprehension-based syntax that minimizes runtime errors by leveraging OCaml's type system.

Key Features

  • Type-Safe Queries — Uses expressive phantom types to catch errors at compile time, reducing runtime failures.
  • Compositional Design — Queries and views are built to be highly reusable and composable, supporting complex query construction.
  • Comprehension Syntax — Provides a readable, comprehension-based syntax (<:view< ... >>) for defining SELECT, INSERT, UPDATE, and DELETE operations.
  • SQL Integration — Supports standard SQL features like GROUP BY, aggregates, LIMIT/OFFSET, and UNION/INTERSECT/EXCEPT operations.
  • Null Safety — Explicitly handles nullable types with Sql.get and Sql.getn to enforce proper null handling.
  • View Abstraction — Treats SQL tables, views, and subqueries as first-class, composable view objects.

Philosophy

Macaque prioritizes compile-time safety and composability, aiming to eliminate runtime SQL errors through rigorous typing while maintaining the expressiveness of raw SQL.

Quick Stats

Stars40
Forks11
Contributors0
Open Issues10
Last commit6 years ago
CreatedSince 2013

Tags

#query-builder#functional-programming#sql-dsl#database-abstraction#type-safe-queries#ocaml

Built With

P
PG'OCaml
C
Camlp4
O
OCaml

Included in

OCaml3.1k
Auto-fetched 1 day ago

Related Projects

IrminIrmin

Irmin is a distributed database that follows the same design principles as Git

Stars1,952
Forks166
Last commit4 months ago
CaqtiCaqti

Cooperative-threaded access to relational data

Stars355
Forks44
Last commit9 days ago
Caqti setence preparation, ppx_rapperCaqti setence preparation, ppx_rapper

Syntax extension for writing SQL in OCaml

Stars154
Forks23
Last commit8 days ago
SQLite3SQLite3

OCaml bindings to the SQLite3 database

Stars131
Forks40
Last commit9 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub