haskell-lectures/VL1/content/VL1_write_haskell14.tex
2015-04-20 00:51:14 +02:00

7 lines
286 B
TeX

And pattern match on it as well:
\begin{haskellcode}
addIntToList :: MaybeInt -> [Int]
addIntToList (NoError x) = [x]
addIntToList (Error str) = []
\end{haskellcode}
So if we got an error, we just return an empty list, otherwise we return a list with the \code{Int} as its only element.