X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=deliverables%2Fp2%2Fp2.tex;h=b7d7639352ea561e0f79cd32ff2306084446d738;hb=HEAD;hp=9f5fc6564df48088f9550fad971b08661837e4da;hpb=7b1d68ab317aaf431d123078daf9bd04f8829de0;p=cc1516.git diff --git a/deliverables/p2/p2.tex b/deliverables/p2/p2.tex index 9f5fc65..b7d7639 100644 --- a/deliverables/p2/p2.tex +++ b/deliverables/p2/p2.tex @@ -3,7 +3,7 @@ \frame{\titlepage} \begin{frame}[fragile] - \frametitle{\textsc{SPLS}} + \frametitle{\textsc{SPLT}} \begin{block}{Features} \begin{itemize} \item Implementation language: @@ -124,7 +124,7 @@ flop(n, l) :: Int -> [Int] -> Bool { \end{CleanCode} \pause \item It is also correctly determined that \CI{Bool} and the return - type of \CI{flop(n,l)} don't match. + type of \CI{flip(n,l)} don't match. \end{itemize} \end{frame} @@ -146,7 +146,6 @@ flop(n, l) { \end{itemize} \end{frame} - \begin{frame}[fragile] \frametitle{Mutual Recursion} \begin{itemize} @@ -191,8 +190,49 @@ var y = id(True); \end{frame} \begin{frame}[fragile] - \frametitle{But wait, there is more!} - \framesubtitle{Trouble that is} + \frametitle{It is not all trouble} + \begin{block}{A lot of functionality works correctly} + \begin{itemize} + \item Typing of \CI{VarDecls} + \pause + \item Typing of type chains: + \begin{CleanCode} +id_poly_wtf(x) :: a -> a +{ + var a = x; + var b = a; + var c = b; + return c; +} + \end{CleanCode} + \end{itemize} + \end{block} +\end{frame} + +\begin{frame}[fragile] + \frametitle{It is not all trouble} + \begin{block}{A lot of functionality works correctly} + \begin{itemize} + \item Typing of \CI{VarDecls} + \item Typing of type chains: + \begin{CleanCode} +id_poly_wtf(x) :: a -> a +{ + a a = x; + a b = a; + a c = b; + return c; +} + \end{CleanCode} + \pause + \item Typing \CI{var l = 1:2:[];} succeeds \\ + while. \CI{var l = []; var x = True:l; var y = 1:l;} fails + \end{itemize} + \end{block} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Why is there so much trouble?} \begin{block}{Our type inference algorithm is too greedy} It globally types a function once it is applied to a value, even if this types it more specified then needed. @@ -243,16 +283,19 @@ var y = id(True); We will implement the Hindley-Miller algorithm exactly instead of \emph{``kinda''} \end{block} + \pause \begin{block}{Split constraint generation and solving} Hide all the nasty details of constraint generation using a Reader-Writer-State-Transformer-Monad + \pause \begin{description} \item[Reader] Reader environment to read fresh type variable \item[Writer] Write constraints to \CI{Constraint} environment \item[State] Gamma \item[Transformer] (Either SemError) \end{description} - \emph{Sadly these monads are not in the Clean library.}\\ + \emph{\small Sadly these monads are not in the Clean library.}\\ + \pause Then solve with a Relatively simple Solver-Monad \begin{CleanCode} :: Solve a = StateT Unifier (Either TypeError) a