| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Harmonic.Database
Contents
Description
The single place the codebase talks to Neo4j. Queries go over the modern
HTTP endpoint (POST /db/neo4j/query/v2, Neo4j 5.23+/2025.x), which
replaced both the Bolt binary protocol dependency and the deprecated
tx/commit HTTP API. HTTP keep-alive pooling in the shared
Manager plays the role a long-lived Bolt pipe used
to: one DbConn serves a whole generation run, including the full
K-attempt loop under attempt N K.
Why not Bolt: the last maintained Haskell Bolt driver speaks protocol 3.0 only, which Neo4j 5 removed — it pinned this project to the EOL Neo4j 4.4. The HTTP endpoint is perf-neutral here (measured ~7.5ms vs ~10ms per generation step on the hottest node, including JSON parsing).
Rows come back as Map Text Aeson.Value — the same field-keyed shape the
old driver produced — so query-site parsing stays a lookup plus a pattern
match.
Connection
An open connection to Neo4j: a keep-alive HTTP manager plus the pre-built request template (endpoint URL and auth header).
connectNeo4j :: IO DbConn Source #
Connect to the local Neo4j from Harmonic.Config (override with the
HA_NEO4J_URL environment variable, e.g. http://localhost:7477 to
point a REPL at a scratch container). Probes the server with RETURN 1
so an unreachable database surfaces the error here, at connect time —
matching what every online generation path expects.
connectNeo4jAt :: String -> IO DbConn Source #
connectNeo4j against an explicit base URL (no trailing slash).