|
- Now you know how a regular function looks like, e.g:
- \begin{haskellcode}
- f :: Int -> Int
- f x = x + 1
- \end{haskellcode}
- But now imagine we need a helper function which is very specific to the current function. In C we would have to define this new helper function at top-level and would probably make it \cinline{static}.
- \pause
- \vspace{\baselineskip}
- \\
- Haskell allows us to \textbf{inline} functions in a few more ways, e.g.:
- \begin{itemizep}
- \item with \hinline{where}
- \item with \hinline{let...in}
- \item anonymously (lambda abstraction)
- \end{itemizep}
- \slidep
- A lot of Haskellers really dislike if you put non-generic functions at the top level. So you can still have atomic pieces, but inline the parts which are very specific to the current function.
|