on master help sign in
I think i'm done with the paper
commit4694f3844cf64fa947db42ad58e99b67b28b29eb authoriko <ilyakooo0@gmail.com> dateSun 16 May 2021, 22:52 (5 years ago) parent6ca73eb
1 file changed+23
docs/paper.lhs+23
docs/paper.lhs+23
@@ -1055,8 +1055,31 @@ Another limitation is that we can not remove predicates if their ``result'' type
10551055
10561056\subsection{Type hints}
10571057
1058+Dynamic types in Nix contain more information than our static type system can convey. A usability improvement to provide more utility to the programmer might be to allow extra information to be tagged onto type information and propagated during type inference. This information would not influence the typechecking algorithm in any way. It would only provide utility to the person reading the resulting types or to external tools.
1059+
1060+Some information that might be useful as type hints:
1061+
1062+\begin{enumerate}
1063+ \item The dynamic type of strings (URI, Path, etc.) – useful information for the programmer
1064+ \item Programmer-supplied annotations. When writing nix expressions it is common practice to have a program in some other programming language embedded in Nix as a string literal. It would be useful to propagate information about the underlying programming language to aid IDEs -- they could enable special syntax highlighting and linting based on the programming language.
1065+\end{enumerate}
1066+
10581067\subsection{Sum types} \label{sec:sumTypes}
10591068
1069+In our static type system we introduced a ``special case'' for the \emph{addition operator} as it could be applied to a number of different types.
1070+
1071+The idea of this improvement is to generalize the case and allow the type system to handle arbitrary sums of arbitrary types. This can be implemented as a predicate stating that a type variable can be a certain type:
1072+
1073+\begin{equation}
1074+ \alpha \lessdot \beta
1075+\end{equation}
1076+
1077+where $\beta$ can be the type $\alpha$. With this predicate, our ``String or Number'' predicate can be expressed as so:
1078+
1079+\begin{equation}
1080+ \strOrNum \sim \alpha = (\text{String} \lessdot \alpha, \text{Number} \lessdot \alpha)
1081+\end{equation}
1082+
10601083\section{Conclusion}
10611084
10621085Nix is a rapidly growing ecosystem. At the time of writing, nixpkgs, the Nix package registry, contains over 60000 packages\footnote{\url{https://github.com/NixOS/nixpkgs}} that can be either installed or used as dependencies in other projects. There is much interest in the approach used by Nix, and making the ever-growing codebase of configurations easier to manage and extend would be a welcome development.