Refactoring a Net Database Connection into a Monadic Interface
summary
Refactors a legacy imperative .NET DB layer into a composable monadic interface, publishing the code at DBMonad and targeting both SQL and SAP HANA connections. Implements a state-like state monad called Queries with map/flatMap/selectMany, file-backed SQL selection, optional/error layering, and run/run-with-transaction execution primitives. Replaces repetitive open/close/try-catch boilerplate, makes queries composable and lazily evaluated, and ships to production successfully while reducing code and simplifying testing even though full unit tests were deferred.
AI-written summary · about
chapters (19)
- 0:00Introduction
- 3:30Code Overview
- 5:15Static Classes
- 10:30DB State
- 13:00File
- 14:00Functions
- 15:00Queries
- 16:30Returns
- 17:35Map
- 18:20Quiz
- 19:40Bind
- 21:30Catch
- 22:10Extension methods
- 22:50Workflow
- 23:45Run Command
- 29:00Variables
- 29:40Deform
- 30:40C Short Local Method
- 31:50C Optional Method
related talks
52mSpecializing the Reader Monad for Pure Database Programming
27mMaking Relational Cool Again (or: JavaScript on ACID)
42mBetter Data Access with Composable Queries
30mPrograms as Values Pure Composable Database Access in Scala
29mModern Database Architecture: From SQL to NoSQL & Distributed SQL
31mQuill + Doobie = Better Together
37mBuilding Database Applications with Database/SQL
54mImplementing a database in Haskell
