{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreibecdwlfe7k4dlwzeveevehgutnvgygez6d75zh2zts52pp2dy7wy",
    "uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mkbv7pbwsek2"
  },
  "path": "/t/modern-haskell-c-translation-approaches/13941#post_10",
  "publishedAt": "2026-04-25T00:04:36.000Z",
  "site": "https://discourse.haskell.org",
  "textContent": "GHC has several IRs. The major ones are :\n\n-Haskell AST . What is left after parsing is complete. Type checking happens here\n-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\n-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.\n-Cmm: traditional low level IR. Strictness and lazyness are no longer explicit, just like any common low level IR like llvm.\n\nI remember other haskell compilers being similar. Idris2 ( a dependent language descended from haskell ) , also has a compiler with similar IRs\n\nIt seems you would want to perform those transformations in Core or STG, if using GHC",
  "title": "Modern Haskell → C translation approaches?"
}