Mercury: An Odd Amalgam of Haskell and Prolog - Part 2 of 2
summary
Claims a working HTTP 1.0 parser written in Mercury that demonstrates Prolog-style unification and determinism annotations, implemented via strict accumulators and reverse-at-end parsing. Live coding repeatedly hits compiler and mode errors (no character literals, overloaded modes, backtracking vs destructive IO), uses trace goals to debug, and ultimately parses the request line and basic headers. Mercury compiles to C/Java backends; several library-mode gaps force handwritten, sometimes non‑bi‑directional primitives.
AI-written summary · about
chapters (17)
- 0:00Introduction
- 1:17Parsing path segments
- 5:09Path accumulation and reversal
- 10:20Syntax quirks in Mercury
- 15:07HTTP request parser
- 20:32Debugging and IO in Mercury
- 27:30Fixing multi-determinism
- 33:34Trace goals for debugging
- 38:12Live debugging
- 44:19Simplifying path parsing
- 46:48Advantages of Mercury
- 47:32Comparison with Haskell and Prolog
- 51:26Mercury versus Haskell
- 53:09Mercury for permissions
- 56:38Industry use cases
- 59:00Backends and performance
- 1:00:11Q&A
related talks
19mHOL4P4: mechanized small-step semantics for P4
24mPurely functional gRPC and HTTP/2 with OCaml
22mDependently-Typed Data Plane Programming
44mServer-side network protocol
26mEnhancing network diagnosis with reflection in Prolog (extended abstract)
41mHTTP API In Action
18mP4Cub: A Little Language for Big Routers
25mP4-SpecTec: A Language Mechanization Framework for P4
