X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=christiaan%2Frecursion.lhs;fp=christiaan%2Frecursion.lhs;h=c3883559296613cdefc54f2d6b1536ead4d1dc79;hb=68dfe53b5995913363ac3fa0240e789e6774cf8a;hp=0000000000000000000000000000000000000000;hpb=a6db20a6d9cfe457b5deb643932813b921a04d47;p=matthijs%2Fmaster-project%2Ffinal-presentation.git diff --git a/christiaan/recursion.lhs b/christiaan/recursion.lhs new file mode 100644 index 0000000..c388355 --- /dev/null +++ b/christiaan/recursion.lhs @@ -0,0 +1,63 @@ +\section{Recursion} +%include talk.fmt +\frame{ +\frametitle{Future Work: Recursion} +\begin{itemize} + \item The most pressing future work is to support recursive functions. + \item Partially explored solution: static loop unrolling + \item Unexplored solution: Haskell language extensions, new source language +\end{itemize} +} + +\subsection{Static loop unrolling} +\frame{ +\frametitle{Static loop unrolling} +\begin{itemize} + \item Unroll, and simplify recursive definitions at compile time. + \item Explored solution: Unrolling number-guided recursive functions using Template Haskell +\end{itemize} +} + +\frame{ +\frametitle{Template Haskell} +\begin{itemize} + \item Template Haskell allows for compile-time inspection, construction, and manipulation of Haskell code. + \item All these functions are expressible in normal Haskell +\end{itemize} +} + +\frame{ +\frametitle{Tree Adder} +\begin{verbatim} +$(do + [typ, _] <- [d|{ +treeSum :: Vector D8 (SizedWord D8) -> SizedWord D8; +treeSum xs = undefined + }|] + [func] <- [d|{ +treeSum i xs | i < 1 = head xs + | otherwise = let (a,b) = split xs + in (treeSum (i-1) a) + + (treeSum (i-1) b) + }|] + let func' = unroll Nothing 0 (IntegerL 3) funct + return [typ,func'] +) +\end{verbatim} +} + +\begin{frame} + \frametitle{Unrolled tree adder} + \begin{figure} + \includegraphics[height=5cm]{treeadder} + \end{figure} +\end{frame} + +\subsection{Input Language} +\frame{ +\frametitle{Input Language} +\begin{itemize} + \item New source language: One of the problems is that Haskell does not properly support dependent types. Investigate languages with dependent type systems. + \item Haskell extentions: Invariant descriptions at the type-level. +\end{itemize} +} \ No newline at end of file