diff --git a/VL1/content/VL1_ADT3.tex b/VL1/content/VL1_ADT3.tex index f923cd7..39374d6 100644 --- a/VL1/content/VL1_ADT3.tex +++ b/VL1/content/VL1_ADT3.tex @@ -11,12 +11,4 @@ So constructors are just \emph{functions}! And they can have arguments, just lik NoError :: Int -> MaybeInt > :t Error Error :: String -> MaybeInt -\end{haskellcode} -\pause -And now we can do sanity checks: -\begin{haskellcode} -calcSomething :: Int -> MaybeInt -calcSomething x - | x < 100 = NoError (x * 5) - | otherwise = Error "Int out of range!" \end{haskellcode} \ No newline at end of file diff --git a/VL1/content/VL1_ADT4.tex b/VL1/content/VL1_ADT4.tex index 97eaa19..f528c27 100644 --- a/VL1/content/VL1_ADT4.tex +++ b/VL1/content/VL1_ADT4.tex @@ -1,3 +1,11 @@ +And now we can do sanity checks: +\begin{haskellcode} +calcSomething :: Int -> MaybeInt +calcSomething x + | x < 100 = NoError (x * 5) + | otherwise = Error "Int out of range!" +\end{haskellcode} +\pause And pattern match on it as well: \begin{haskellcode} addIntToList :: MaybeInt -> [Int]