This thesis is about implementing a compiler in Haskell. The source dialect of SQL consists of reading queries only. The compiler has to cover aggregations, correlated subqueries and window functions. The target language will be KL (short for: Kernel Language), an imperative language designed for provenance analysis. All input queries have type annotations. These are to be translated as well.