\ifger{Jetzt wollen wir etwas komplexere ADTs definieren. Z.b. einen Tree:}{Let's define something more complex. How about a tree?} \pause \begin{haskellcode} data Tree = Leaf Char | Node Tree Int Tree \end{haskellcode} \ifger{Verwirrt? Schauen wir genauer hin.}{Uh... that looks mean. Let's examine this.}\\ \pause \ifger{Wir haben}{We have}: \begin{itemizep} \item \ifger{den Datentyp \hinline{Tree} definiert}{defined a data type \hinline{Tree}} \item \ifger{einen Konstruktor \hinline{Leaf} vom Typ \hinline{Tree} mit einem Argument vom Typ \hinline{Char}}{a constructor \hinline{Leaf} of type \hinline{Tree} with one arguments of type \hinline{Char}} \item \ifger{einen Konstruktor \hinline{Node} vom Typ \hinline{Tree} mit 3 Argumenten}{a constructor \hinline{Node} of type \hinline{Tree} with 3 arguments} \begin{itemizep} \item \hinline{Tree} \item \hinline{Int} \item \hinline{Tree} \end{itemizep} \end{itemizep} \slidep \ifger{Das bedeutet: ein \hinline{Tree} kann entweder ein \hinline{Leaf} oder eine interne \hinline{Node} sein mit 2 Subtrees. Wollen wir einen \hinline{Leaf} erzeugen, müssen wir dem Konstruktor einen \hinline{Char} übergeben. Wollen wir eine \hinline{Node} bauen, müssen wir 3 Argumente in Reihenfolge übergeben: ein weiterer \hinline{Tree}, ein \hinline{Int} und noch ein \hinline{Tree}.}{That means: a \hinline{Tree} can either be a \hinline{Leaf} or an internal \hinline{Node} with two sub-trees. If we want to create a \hinline{Leaf}, we have to pass the constructor a \hinline{Char}. If we want to create a \hinline{Node}, we have to pass 3 arguments, in order: another \hinline{Tree}, an \hinline{Int} and yet another \hinline{Tree}.}\\ \ifger{D.h. wir können Informationen sowohl in den leafs (\hinline{Char}) als auch in den internen nodes (\hinline{Int}) speichern. Dies ist nur ein Beispiel.}{So we can save information in the leafs (\hinline{Char}) and in the internal nodes (\hinline{Int}).\\ This is just an example. There are endless more ways of trees.}