Move section to next slide
This commit is contained in:
parent
4559b2f1d9
commit
b43b9e2456
@ -12,11 +12,3 @@ NoError :: Int -> MaybeInt
|
|||||||
> :t Error
|
> :t Error
|
||||||
Error :: String -> MaybeInt
|
Error :: String -> MaybeInt
|
||||||
\end{haskellcode}
|
\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:
|
And pattern match on it as well:
|
||||||
\begin{haskellcode}
|
\begin{haskellcode}
|
||||||
addIntToList :: MaybeInt -> [Int]
|
addIntToList :: MaybeInt -> [Int]
|
||||||
|
Loading…
Reference in New Issue
Block a user