Skip to content

Add support for higher-rank polymorphism

Jan-Hendrik Matthes requested to merge higher-rank-polymorphism into master

This merge request adds support for higher-rank polymorphism to the parser. Furthermore a new language extension RankNTypes is introduced. The representation of AbstractCurry is also adapted to support higher-rank polymorphism.

The recognized syntax of Curry will change as follows (only the relevant parts are listed):

\begin{aligned}
\cdots
\end{aligned}
\begin{aligned}
\textit{ConstrDecl}   &::=\dots\\
                      &\phantom{::}\mid\phantom{!)}\textit{AppTypeExpr}~\textit{ConOp}~\textit{AppTypeExpr}\\
                      &\phantom{::}\mid\phantom{!)}\dots\\
\textit{ForallVarID}  &::=\textit{Ident}\\
\textit{ForallVars}   &::=\texttt{forall}~\textit{ForallVarID}_{1}\ldots\textit{ForallVarID}_{n}~\texttt{.} &&(n\geq 1)\\
\textit{TypeExpr}     &::=\{\textit{ForallVars}\}~[\textit{Context}~\texttt{=>}]~\textit{FuncTypeExpr}\\
\textit{FuncTypeExpr} &::=\textit{AppTypeExpr}~[\texttt{->}~\textit{TypeExpr}]\\
\textit{AppTypeExpr}  &::=[\textit{AppTypeExpr}]~\textit{SimpleTypeExpr}\\
\textit{Signature}    &::=\textit{Functions}~\texttt{::}~\textit{TypeExpr}\\
\textit{Expr}         &::=\textit{InfixExpr}~\texttt{::}~\textit{TypeExpr}\\
                      &\phantom{::}\mid\phantom{=}\dots
\end{aligned}
\begin{aligned}
\cdots
\end{aligned}
\begin{aligned}
\textit{QualTypeExpr} &::=\dots &&(\text{removed})\\
\textit{TypeAppExpr}  &::=\dots &&(\text{removed})
\end{aligned}
\begin{aligned}
\cdots
\end{aligned}
Edited by Jan-Hendrik Matthes

Merge request reports

Loading