MicroHs, a tiny Haskell Compiler
summary
MicroHs is a tiny Haskell compiler that translates Haskell to Turner-style combinators, emits a C byte array, then uses a C compiler to produce a compact runtime-linked executable. It produces a ~300 KB binary (vs ~37 MB when built with GHC), recompiles itself in ~8–11s, and measures ~3 ns per combinator reduction. It supports cross-compilation and runs on microcontrollers (Morse demo), serializes cached graphs for fast incremental builds.
AI-written summary · about
chapters (28)
- 0:00· Introducing Lennart Augustsson
- 1:50· What is microHs? A small Haskell compiler
- 3:22· Live installation demo
- 5:14· Interactive mode and math with complex numbers
- 6:37· Compiling and running Haskell programs
- 8:10· Comparing binary sizes: microHs vs. GHC
- 10:13· Cross-compilation & WebAssembly support
- 14:02· Why build another Haskell compiler?
- 16:12· Combinator-based compilation (Turner-style)
- 17:02· Running on bare metal and microcontrollers
- 19:54· microHs vs. GHC: Speed and binary size
- 21:16· Implemented language extensions
- 23:22· Limitations: No Template Haskell, some concurrency
- 24:00· microCabal: Building packages without full Cabal
- 26:00· Compiler architecture overview
- 27:48· Serialization and caching
- 30:00· Church & Scott encoding of data types
- 33:15· Overview of SKI combinators
- 36:02· Optimization rules and combinator reduction
- 38:10· Self-optimizing properties of combinators
- 40:14· Specialization and dictionary elimination
- 44:23· The C runtime and performance: ~3ns per reduction
- 46:22· Garbage collection: bitmap-based strategy
- 49:28· Compilation statistics: combinators, GC, runtime
- 51:19· Serialization formats and portability
- 53:28· Running microHs on microcontrollers (Morse demo)
- 54:10· Community contributions & thanks
- 55:26· Audience Q&A: Hardware execution, performance, IO, etc.
related talks
26mMicroHs Dead or Alive?
15mMetaprogramming with Combinators
25mCompiling Mu with GHC: Halfway Down the Rabbit Hole
40mAn Introduction to Combinator Compilers and Graph Reduction Machines
15mA Small Scheme VM, Compiler and REPL in 4K
34mMicrowatt Microarchitecture
01h 26mHaskell Language Server
01h 02mOptimising for fast builds with GHC
