*Katrin*is a modern, functional, general-purpose programming language with dependent types.
*Katrin*will be a modern, functional, general-purpose programming language with dependent types.
At this point it's just [a collection of ideas](ideas.md), [some examples of future code](example.katrin) and some ground work for an algebraic compiler written in Haskell.
- Probably mainly strict with explicit laziness possible (like in Idris) because of performance and algebraic typing
- Strict evaluation -> foldr of expression tree
- Totality enforced by default (no `fromJust`, `error` etc.)?
- Do the pros outweigh the cons here?
- Not decidable in general, so it's a burden on the user if the totality checking fails
@@ -144,7 +145,7 @@ Implement a algebraic compiler using `megaparsec` for parsing in Haskell and lat
Katrin code ist first parsed into a normal abstract syntax tree. This is then transferred into KatrinLite, which is essentially a desugared version of Katrin. KatrinLite is then translated to KatrinCore, which is a basic representation based on the lambda calculus without any advanced features. This is then compiled to an external intermediate language which can be used with a external compiler to produce machine code.
- [Idris2](https://github.com/edwinb/Idris2) uses »quantitative type theory« as base for the core language, look into that
- [System F](https://en.wikipedia.org/wiki/System_F) (extended for GHC with GADTs to System F~c~)
- GHC uses [System F](https://en.wikipedia.org/wiki/System_F) as intermediate representation, extended with GADTs to System F~c~
- Type-checking on KatrinLite or KatrinCore?
- Optimizations on KatrinLite or KatrinCore or both? KatrinCore should be optimal for this, while some simplifications of course need to be performed when compiling Lite to Core.
- Is using two intermediate languages even helpful?
@@ -154,11 +155,11 @@ Katrin code ist first parsed into a normal abstract syntax tree. This is then tr
- Idris2 also does this: They have a intermediate (TTImp) and a core language.
- Do we need a runtime system to be linked against? Probably. Look into the Haskell runtime system.
Which intermediate language could be used to produce binaries?
Which intermediate language could be used for the backend to produce binaries?
- Recursion not directly possible because of all functions being anonymous
(That is, values can be defined and used later as syntactic sugar: `x=5; x+1` could be modelled as `(λx.x+1)5`, but this doesn't work for recursion or circular dependencies)
- Instead it is modeled via fixed-points: [Fixed-point operator](https://en.wikipedia.org/wiki/Fixed-point_combinator)