Compiling Mu with GHC: Halfway Down the Rabbit Hole
summary
Migrating the Mu compiler to use GHC as a frontend targets a 4.5 million‑line codebase and already compiles real Mu programs, including complex GUI apps, after about two years of work. The pipeline uses the GHC API (via a vendored GHC tree), some upstream patches, a few local GHC patches, and type‑checker plugins for Mu features. Key runtime mismatches: Mu/Cortex are mostly strict, lack parametricity, and require explicit instantiation, so the build performs whole‑program monomorphization and aggressive specialization before emitting Cortex bytecode.
AI-written summary · about
chapters (7)
- 0:00Introduction to Mu and Cortex
- 1:32Compiler project goals
- 5:15Mu language features
- 9:24Cortex runtime semantics
- 14:44Integrating the GHC API
- 18:37Compilation challenges
- 22:35Lessons and reflections
related talks
01h 06mMicroHs, a tiny Haskell Compiler
15mMetaprogramming with Combinators
12mCoding Agents for Compiler Construction: Beyond the...
48mCross-Domain Compilation: Exploiting Synergies Across the CS Community
17mMu tilde (re)cycled
15mAmalgamating Different JIT Compilations in a Meta-tracing JIT Compiler Framework
15mUsing MMTk Garbage Collection in GHC (Lightning Talk)
01h 28mInto the Core Squeezing Haskell into nine Constructors
