[FMFP] Typing introduction

This commit is contained in:
2026-03-05 14:12:06 +01:00
parent e83c64315a
commit 43352a0b10
3 changed files with 10 additions and 0 deletions

View File

@@ -1,3 +1,6 @@
A great type system is essential for all programming languages, but especially so for functional programming languages.
The issue however is that the problem of deciding which expressions are good and which ones aren't is undecidable.
Thus, languages only allow a subset of good expressions.
The goal is to make the type system as unrestrictive as possible while still retaining quick, static code analysis.

View File

@@ -2,3 +2,10 @@
This is a stripped down version of Haskell, used here to explore the type system Haskell uses
\subsubsection{Syntax}
Programs are terms, the core is the lambda-calculus, where $\cV$ is the set of variables and $\Z$ the set of integers:
\[
t :: = \cV \divider (\lambda x. t) \divider (t_1 t_2) \divider True \divider False \divider (\textbf{iszero } t) \divider \Z \divider (t_1 + t_2) \divider t_1 * t_2
\divider \textbf{if } t_0 \textbf{ then } t_1 \textbf{ else } t_2 \divider (t_1, t_2) \divider (\textbf{fst } t) \divider (\textbf{snd } t)
\]
It is easily possible to add additonal syntax and types and we employ syntactic sugar, such as omitting parenthesis.