I didn't use the Haskell highlighting offered by listings
, because it highlights too many words (like List, etc.) which are not highlighted in the example.
\documentclass[12pt,DIV13]{scrartcl}
\usepackage{fontspec,listings,xcolor,lipsum}
% Fonts
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Gill Sans Std}
\setmonofont{Lucida Sans Typewriter OT}
% Colors
\definecolor{darkgray}{HTML}{404040}
\definecolor{rulegray}{HTML}{DADADA}
\definecolor{keywordblue}{HTML}{1F497C}
% Listings
\lstdefinestyle{code}{
basicstyle=\ttfamily,
keywordstyle=\color{keywordblue},
keywords={import,qualified,as,do,where}
}
\newcommand\clearlines[1]{%
\if#10\else%
\leavevmode\\%
\expandafter\clearlines\expandafter{\the\numexpr#1-1}%
\fi}
\begin{document}
\lipsum[1]
\begin{center}
\footnotesize
\begin{minipage}{.25\linewidth}
\color{darkgray}\raggedleft\itshape
imports, aliases (1-3) \clearlines{5}
Split all lines in the file. (6-7) \clearlines{3}
Insert them into the map (9)
\end{minipage}
\hfill{\color{rulegray}\vrule}\hfill
\begin{minipage}{.73\linewidth}
\begin{lstlisting}[style=code]
import Data.List (foldl')
import qualified Data.ByteString.Lazy.Char8 as BStr
import qualified Data.Map as Map
readDatafile name = do
sheet <- (map (BStr.split '\t') . BStr.lines) `fmap`
BStr.readFile name
return $ foldl’ go Map.empty sheet
where go m (x:xs) = Map.insert (BStr.unpack x) xs m
\end{lstlisting}
\end{minipage}
\end{center}
\lipsum[1]
\end{document}

Adapting Martin Scharrer's answer to a similar question one can obtain a simpler version:
\documentclass[12pt,DIV13]{scrartcl}
\usepackage{fontspec,listings,xcolor,lipsum}
% Fonts
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Gill Sans Std}
\setmonofont{Lucida Console}
% Colors
\definecolor{darkgray}{HTML}{404040}
\definecolor{rulegray}{HTML}{DADADA}
\definecolor{keywordblue}{HTML}{1F497C}
% Listings
\lstnewenvironment{beautifulcode}{
\lstset{
basicstyle=\footnotesize\ttfamily,
keywordstyle=\color{keywordblue},
keywords={import,qualified,as,do,where},
frame=l,rulecolor=\color{rulegray},framesep=.5em,
escapeinside={(*@}{@*)},
escapebegin={\begin{lrbox}{0}\normalfont\itshape\footnotesize\color{darkgray}},
escapeend={\end{lrbox}\llap{\box0\hspace{1em}}}
}
\hspace*{.25\linewidth}
\minipage{.75\linewidth}
}{
\endminipage
}
\begin{document}
\lipsum[1]
\begin{beautifulcode}
(*@imports, aliases (1-3)@*)import Data.List (foldl')
import qualified Data.ByteString.Lazy.Char8 as BStr
import qualified Data.Map as Map
readDatafile name = do
(*@Split all lines in the file. (6-7)@*) sheet <- (map (BStr.split '\t') . BStr.lines) `fmap`
BStr.readFile name
return $ foldl’ go Map.empty sheet
(*@Insert them into the map (9)@*) where go m (x:xs) = Map.insert (BStr.unpack x) xs m
\end{beautifulcode}
\lipsum[1]
\end{document}
listings
orminted
are the two usual packages for highlighted code listings