haskell-lectures/VL2/content/VL2_polymorphism2.tex

10 lines
619 B
TeX

\ifger{Beginnen wir mit einer polymorphen Funktion, die wir bereits kennen:}{Let's start with a polymorphic function that you already know:}
\begin{haskellcode}
head :: [a] -> a
\end{haskellcode}
\pause
\ifger{Also, }{So} \hinline{head} \ifger{nimmt eine Liste irgendeines (unbekannten) Typs und gibt uns ein einziges Elements dieser Liste zurück, mit \emph{exakt} demselben Typ.}{takes a list of any type and returns an element which must have the \emph{exact same} type of that list.}
\vspace{\baselineskip}
\\
\pause
\ifger{Frage: könnte \hinline{a} eine Funktion sein?}{Question: could \hinline{a} be a function?}