announcement Experimental Dependent Types in Haskell Fork
Hey all!
Today I’m releasing my fork of GHC with -XDependentTypes. You can try it in the browser or walk through the examples.
I figured that if the slop cannon could help with the Riemann hypothesis, it could handle Dependent Haskell. And it did!
To see what the fork could do, I had Gemini 4 Neon port Programming Language Foundations in Agda to Dependent Haskell. Thanks to the GHC Wasm backend, you can work through the 25-chapter book directly in your browser. It even has an Agda mode built on my work on valid hole fits. Leave a hole in a proof and a hole-fit plugin can suggest what goes there.
There are examples of type-directed JSON encoding without type families, typed SQL schemas and joins, and Servant-style routing. You can select your monad transformer stack at runtime! The walkthrough also covers type-level case and lambdas, and linear protocols.
My goal is to build hype around dependent types in Haskell and show how much of the design is already there in the proposals. I’m releasing this as an experimental fork. I don’t plan to upstream it myself, though the GHC team is welcome to use it.
If you want to try it in your own project, there’s a dependent-base library. You can get it through dependent-hackage, an overlay along the lines of head.hackage. It also carries patches for tools like Fourmolu that need to understand the new syntax.
There’s even an observational equivalence plugin. Say you have a dependently typed implementation and a fast path written in ordinary Haskell. You can ask QuickCheck to look for inputs where the two disagree. If it finds one, you get a counterexample. If the tests pass, the result is only as strong as the generators and tests you chose.
Validation
The two main users so far have been the PLFH book and my PiTA library. The book turned up compiler bugs and showed where writing proofs was awkward. PiTA extends equality-constrained tree automata with dependent types and uses them to search for valid hole fits. Two plugins also exercise GHC’s internals: the observational equivalence plugin and a typed-hole proof helper.
I assume the implementation is full of holes (typed holes even) and bugs, but those can be fixed. I've run a sweep of Stackage and most packages compile, barring some minor shims for GHC 10.1 compatibility. Some minor compiler issues are being fixed as well.
Development notes
The initial work was done mostly by GPT-6.2 Astra managing a team of GPT-6.2 Sol agents. After I ran out of usage and resets, Gemini took over the compiler work with a team of Gemini 4 Carbon models. Both teams used their native harnesses, with some additional skills based on Well-Typed blog posts, anti-slop and humanizer skills for writing, and an internal agentic engineering plugin at DPella AB. Claude worked on PiTA and turned up several compiler issues.
I based the prompts on GHC proposal #378, the Serokell roadmap, and Richard Eisenberg’s thesis, papers, and old GHC branch.
The compiler, book, and PiTA work came to about 37.1 billion tokens in total, roughly 98% of them cache reads. At public API rates, the estimate came to around $16k. I ran it all on subscriptions, with some help from three banked resets, OpenAI’s generously timed billing bug, and Gemini’s Thanksgiving reset. So no need for a GoFundMe!
Acknowledgements
Thanks to Richard Eisenberg for proposal #378, his thesis, and the old GHC branch that gave us a place to start. Thanks to Vladislav Zavialov, Andrei Borzenkov, and the rest of the Serokell team for the roadmap and years of work on GHC, and to everyone who wrote and reviewed the other proposals we drew on.
Thanks to Philip Wadler, Wen Kokke, and Jeremy G. Siek for PLFA. Having a book full of proofs written for another language was a great way to find out where our compiler fell short.
Thanks to Cheng Shao, Norman Ramsey, and the other GHC Wasm contributors for making it possible to try this in a browser. Thanks to Jules (@analytichegel on Twitter) for the observational equivalence idea behind the QuickCheck plugin.
Thanks to Mercury for ghc-persistent-worker. With a few tweaks, it made those repeated incremental GHC builds a lot faster! And thanks to Andrea Bedini and IOG for Foliage, whose package metadata format we use in dependent-hackage.
Thanks for reading! I hope you get a chance to play around with it. If you find a bug, please file an issue on the fork. I’d love to see what people try with it, and I hope this builds some excitement for getting dependent types into GHC itself.
