\begin{slide}{Typconstraints (Haskell)}

\begin{verbatim}
class C t where m :: t -> Int
data A ; instance C A where m = ...
data B ; instance C B where m = ...

f :: C t => t -> Int ; f x = m x * 2
\end{verbatim}

Implementierung durch \emph{Dictionaries}

\begin{verbatim}
data CDict t = CDict { m :: t -> Int }
f :: CDict -> t -> Int ; f d x = m d x * 2
\end{verbatim}

\end{slide}

