%% -*- mode: latex; TeX-master: "compilerbau.tex"; -*-

\begin{slide}{Funktionen höherer Ordnung}

\kopf{$ $Id: map.tex,v 1.1 2011-10-16 14:06:16 waldmann Exp $ $}

\begin{verbatim}
twice :: (a -> a) -> (a -> a)
twice f = \ x -> f ( f x )

map :: (a -> b) -> (List a -> List b)
map f = \ l -> case l of
    Null -> Null
    Cons {} -> Cons { head = f ( head l ) , tail = map f ( tail l ) }
\end{verbatim}

Aufgabe: Typinferenz für 
\verb|(twice (twice succ)) 0|,
\verb|((twice twice) succ) 0|,
\verb|map succ [1,2,3]|,
\verb|map (map succ) l|,
wobei \verb|succ :: Integer -> Integer|







\end{slide}
