From 81170661bc13629001df7cf1d4d71a1327041de7 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Thu, 16 Apr 2015 01:31:15 +0200 Subject: [PATCH] Reorder for improved clarity --- VL1.tex | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/VL1.tex b/VL1.tex index 443fafc..51b3196 100644 --- a/VL1.tex +++ b/VL1.tex @@ -501,16 +501,6 @@ data MaybeInt = NoError Int | Error String \end{lstlisting} \pause -And now we can do sanity checks: -\pause -\setHaskellCodeStyle -\begin{lstlisting} -calcSomething :: Int -> MaybeInt -calcSomething x - | x < 100 = NoError (x * 5) - | otherwise = Error "Int out of range!" -\end{lstlisting} -\pause So constructors are just \emph{functions}! And they can have arguments, just like functions. Let's check their types: \setHaskellCodeStyle \begin{lstlisting} @@ -519,6 +509,15 @@ NoError :: Int -> MaybeInt > :t Error Error :: String -> MaybeInt \end{lstlisting} +\pause +And now we can do sanity checks: +\setHaskellCodeStyle +\begin{lstlisting} +calcSomething :: Int -> MaybeInt +calcSomething x + | x < 100 = NoError (x * 5) + | otherwise = Error "Int out of range!" +\end{lstlisting} \end{frame} \begin{frame}[fragile]