Making another DSL in Haskell: case study
summary
Demonstrates a Haskell embedding of Neo4j's Cypher that turns string queries into statically checked DSL programs, implemented as a free-monadic API that tracks node/relationship labels, parameters and variable scopes at the type level. Uses Generics, Type Families and polykinds to derive label names and enforce field presence, uses overloaded labels for named parameters, and adds custom type errors and rebindable syntax so GHC rejects mismatched variables and missing params at compile time; the implementation compiles and runs.
AI-written summary · about
chapters (20)
- 0:00Intro
- 1:35No4J
- 2:25Cypher query
- 3:26Running the query
- 4:26Creating the DSL
- 5:15Defining the domain
- 6:46Model selectors
- 10:21Type families
- 12:08New type
- 14:16Note selectors
- 15:00Name of a type
- 16:56Type errors
- 19:16Wrapper
- 20:25Typeclass
- 22:01Run query
- 22:43Run return record
- 26:53Type tags
- 30:38Two statements
- 32:30Compile
- 33:59References
