Modern Haskell → C translation approaches?
Haskell Community [Unofficial]
April 25, 2026
GHC has several IRs. The major ones are :
-Haskell AST . What is left after parsing is complete. Type checking happens here
-Core. Simpler than AST but still typed. Many haskell specific optimizations are performed. Additional type checking happens here , but i dont remember how neccesary they are. I have heard the additional type checking is peformed to prevent an incorrect coded transformation from AST resulting into incorrect code
-STG : Untyped representation originally designed to represent code in such a way that enables efficient compilation of non strict code into cpus not designed for that paradigm.
-Cmm: traditional low level IR. Strictness and lazyness are no longer explicit, just like any common low level IR like llvm.
I remember other haskell compilers being similar. Idris2 ( a dependent language descended from haskell ) , also has a compiler with similar IRs
It seems you would want to perform those transformations in Core or STG, if using GHC
Discussion in the ATmosphere