Unify example

This commit is contained in:
JanUlrich 2024-05-02 16:14:35 +02:00
parent 4ec030d731
commit b9ef35526f

View File

@ -20,6 +20,17 @@ someList(){
}
\end{lstlisting}
Constraints for the untyped \texttt{someList} method:
\begin{constraintset}
$\begin{array}{l}
\exptype{List}{\tv{x}} \lessdot {\tv{r}}, \type{String} \lessdot {\tv{x}},
\exptype{List}{\tv{y}} \lessdot {\tv{r}}, \type{Integer} \lessdot {\tv{y}}
\end{array}$
\end{constraintset}
The constraint $\type{String} \lessdot {\ntv{x}}$ is solved by applying
\rulename{Super} and substituting $\type{String}$ for $\ntv{x}$.
\subsection{Description}
The \unify{} algorithm tries to find a solution for a set of constraints like
$\set{\exptype{List}{String} \lessdot \tv{a}, \exptype{List}{Integer} \lessdot \tv{a}}$.