What language is Haskell written in?

compiler-construction, haskell, io

Solution

Haskell implementations are written in a range of languages.

For example, GHC is:

- runtime: a mixture of C, assembly and C--

- compiler: Haskell, Happy (for parsing), and Alex (for lexing)

- libraries: Haskell and a few C bindings, a little assembly and C--

The primops are the native instructions of the runtime. They in turn are implemented in the runtime via C, C-- and assembly fragments.

IO in particular is mediated via the IO manager, and via foreign libraries of IO primitives.

Problem

Also (besides the title question), is there source code available for different impure Haskell functions like IO? I don't mean the Haskell side of the code, but whatever Haskell implements to do IO.

Original source