thesis / extcore.tex

\chapter{GHC's external core}
This chapter describes \gls{ghc}'s external core functionality, its limitations
and issues (\autoref{sec:issues}), and what needs to be done to improve it.

External core is an external representation of the Core datastructure used in
\gls{ghc}'s compilation process\footnote{\gls{ghc}'s compilation process can be
seen in \mypref{fig:ghc-compilation}.}. As explained in \autoref{sec:ghc},
\gls{ghc} desugar Haskell to Core, after which \gls{ghc}'s main optimizations
are performed as semantics-preserving transformations on Core. The language
that the Core datastructure implements is described in \mypref{sec:core}.

External core representation of a Haskell source file is produced by giving
\gls{ghc} the flag \mycode{-fext-core}. \gls{ghc} also supports parsing
external core back into Core, and there is a Haskell package for parsing
and working with external core called \textit{extcore}\footnote{External core
parser package extcore:}.

PyHaskell takes Haskell code converted to external core as input, which it
then converts to a \gls{json} representation before it parses and evaluates
it. PyHaskell's pipeline is explained in detail in \mypref{sec:pipeline}.

\section{Limitations and issues}
While Core has been improved and upgraded to different iterations based of
\sysf (currently \sysfp), external core has been neglected and drifted out of
sync with Core. 
%getting External Core and Core back in sync

\section{Improvements and solutions}

\subsection{GHC API}
Why not GHC API.

\section{Future work}