2026 · Warwick coursework

λGPT — a natural-language REPL built from parser combinators, not an LLM

A conversational interface with no model behind it. Every intent is a parser, every answer is derived, and nothing is generated.

HaskellMegaparsecAesonhttp-conduitStack

a conversational interface with nothing generative in it

λGPT answers questions in natural language without a model anywhere in the loop. Every intent is a parser, every answer is derived from the input, and nothing is generated. Written in Haskell as Warwick coursework.

parsing intent with backtracking

Megaparsec’s try lets the parser backtrack between “what is two plus two” and “what is the weather like today” without consuming input. string' and optional make it case-insensitive and tolerant of trailing punctuation, so valid input doesn’t fail on a missing question mark.

arithmetic over an AST, errors as values

Arithmetic is evaluated over an AST with a foldl accumulator for left-to-right natural-language precedence — “two plus three times four” means what a speaker means by it, not what an algebra parser means.

evaluateExpr returns Either String Int, so referencing “that” before any maths has happened is an error value rather than a runtime crash.

past the spec: a live forecast that cannot take the REPL down

Went past the spec with a live Open-Meteo forecast, isolated in its own module and fetched with httpJSONEither — a dropped network returns a polite string instead of killing the REPL. Keyless by choice, so it can’t fail on someone else’s rate limit.

memory without a monad transformer

Memory is an explicit association list threaded through the loop by tail recursion rather than a StateT transformer over IO — less machinery, same guarantee.

all workjosh beira