Move section to next slide
This commit is contained in:
parent
4559b2f1d9
commit
b43b9e2456
@ -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}
|
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user