liveBook · Manning

KVDBL

As explained in Functional Design and Architecture: Examples in Haskell

KVDBL is a book-specific free-monadic language providing a raw string-based interface to a key-value database.

KVDBL is a free-monadic language for operating on key–value storage through a deliberately raw, string-based interface. It separates database operations from the application’s business logic while leaving serialization of domain values to the developer. section 11.0 section 11.1.2

The basic interface defines:

  • A phantom database type that prevents accidental mixing of databases such as ValuesDB and AstroDB. section 11.1.2
  • Operations for reading, writing, searching, updating, and deleting without embedding database connections in the language itself. section 11.1.2

Running a typed database scenario

A program can load a value from AstroDB by selecting the database type, then execute the resulting KVDBL scenario through an explicit DBHandle. The handle records the database implementation and name, while business queries remain separate from connectivity.

Figure 11.1 Framework subsystems: a new free monadic language is added to the hierarchy

The subsystem hierarchy shows KVDBL as a new free-monadic language beneath a later typed and type-safe interface. section 11.0

How Functional Design and Architecture: Examples in Haskell covers it

How deep it goes
Defines operations, database typing, errors, evaluation, and connectivity, while deferring domain serialization and backend implementation.
Examples
Uses ByteString Save and Load operations, ValuesDB and AstroDB types, typed loads, DBResult errors, and explicit DBHandle evaluation.
What it assumes
Assumes external data storage and byte serialization, while introducing database typing, operation errors, and connectivity boundaries.
What you can do after
Apply it via a free-monadic interface to describe raw database operations and evaluate them through an explicitly supplied handle.
How it connects
Connects free monads with key–value databases, serialization, phantom types, error handling, database handles, and type-safe interfaces.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Functional Design and Architecture: Examples in Haskell. The section links point to the parts of the book it draws on.