\begin{slide}{Beispiel: Haskell2Xml}

\begin{verbatim}
data Tree a = Leaf
            | Node { key :: a
                   , colour :: Colour
                   , left :: Tree a
                   , right :: Tree a
                   }
{-! for Tree derive: Haskell2Xml !-}
\end{verbatim}
Präprozessor \verb|DrIFT| erzeugt daraus Quelltext
(Instanz für Interface)
\begin{verbatim}
class Haskell2Xml a where
    toXml   :: a -> Document
    fromXml :: Document -> a
\end{verbatim}

\end{slide}

\begin{slide}{Haskell2Xml (II)}
\begin{verbatim}
Node { key = 4, colour = Black
   , left = Node { key = 1, colour = Black
                 , left = Leaf, right = Leaf }
   , right = Leaf }
\end{verbatim}
Objekt (oben), Repräsentation (unten)
\begin{small}
\begin{verbatim}
<Tree-int-XML>
 <Node-int>
    <int value="4" /> <Black />
    <Node-int >
      <int value="1" /> <Black /><Leaf /><Leaf/>
    </Node-int>
    <Leaf/>
  </Node-int>
</Tree-int-XML>
\end{verbatim}
\end{small}  
\end{slide}
