Browse Source

Reorder for improved clarity

Julian Ospald 4 years ago
parent
commit
81170661bc
No account linked to committer's email address
1 changed files with 9 additions and 10 deletions
  1. 9
    10
      VL1.tex

+ 9
- 10
VL1.tex View File

@@ -501,16 +501,6 @@ data MaybeInt = NoError Int
501 501
               | Error String
502 502
 \end{lstlisting}
503 503
 \pause
504
-And now we can do sanity checks:
505
-\pause
506
-\setHaskellCodeStyle
507
-\begin{lstlisting}
508
-calcSomething :: Int -> MaybeInt
509
-calcSomething x
510
-  | x < 100   = NoError (x * 5)
511
-  | otherwise = Error "Int out of range!"
512
-\end{lstlisting}
513
-\pause
514 504
 So constructors are just \emph{functions}! And they can have arguments, just like functions. Let's check their types:
515 505
 \setHaskellCodeStyle
516 506
 \begin{lstlisting}
@@ -519,6 +509,15 @@ NoError :: Int -> MaybeInt
519 509
 > :t Error
520 510
 Error :: String -> MaybeInt
521 511
 \end{lstlisting}
512
+\pause
513
+And now we can do sanity checks:
514
+\setHaskellCodeStyle
515
+\begin{lstlisting}
516
+calcSomething :: Int -> MaybeInt
517
+calcSomething x
518
+  | x < 100   = NoError (x * 5)
519
+  | otherwise = Error "Int out of range!"
520
+\end{lstlisting}
522 521
 \end{frame}
523 522
 
524 523
 \begin{frame}[fragile]