21 lines
572 B
TeX
21 lines
572 B
TeX
Let's make our first function. We want something like the following mathematical function\\
|
|
$f(x) = x * x$
|
|
\vspace{\baselineskip}
|
|
\\
|
|
How could the haskell code look like?
|
|
\pause
|
|
Almost the same:
|
|
\begin{haskellcode}
|
|
f x = x * x
|
|
\end{haskellcode}
|
|
\vspace{\baselineskip}
|
|
GHCi...
|
|
\pause
|
|
\vspace{\baselineskip}
|
|
\\
|
|
What is a possible type signature for this function?
|
|
\begin{haskellcode}
|
|
f :: Int -> Int
|
|
f x = x * x
|
|
\end{haskellcode}
|
|
So the function gets an Int and returns an Int. Don't get confused by "\verb|->|". Just think of it as a symbol for separating input and output. |