1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-12 14:28:08 +03:00
juvix/test
Jan Mas Rovira 2d666fd82c
Named arguments (#2250)
- closes #1991 

This pr implements named arguments as described in #1991. It does not
yet implement optional arguments, which should be added in a later pr as
they are not required for record syntax.

# Syntax Overview

Named arguments are a convenient mehcanism to provide arguments, where
we give the arguments by name instead of by position. Anything with a
type signature can have named arguments, i.e. functions, types,
constructors and axioms.

For instance, if we have (note that named arguments can also appear on
the rhs of the `:`):
```
fun : {A B : Type} (f : A -> B) : (x : A) -> B := ... ;
```
With the traditional positional application, we would write
```
fun suc zero
```
With named arguments we can write the following:
1. `fun (f := suc) (x := zero)`.
2. We can change the order: `fun (x := zero) (f := suc)`.
3. We can group the arguments: `fun (x := zero; f := suc)`.
4. We can partially apply functions with named arguments: `fun (f :=
suc) zero`.
5. We can provide implicit arguments analogously (with braces): `fun {A
:= Nat; B := Nat} (f := suc; x := zero)`.
6. We can skip implicit arguments: `fun {B := Nat} (f := suc; x :=
zero)`.

What we cannot do:
1. Skip explicit arguments. E.g. `fun (x := zero)`.
2. Mix explicit and implicit arguments in the same group. E.g. `fun (A
:= Nat; f := suc)`
3. Provide explicit and implicit arguments in different order. E.g. `fun
(f := suc; x := zero) {A := Nat}`.
2023-07-18 10:32:34 +01:00
..
Arity Add juvix global project under xdg directory and other improvements (#1963) 2023-04-13 11:27:39 +02:00
Asm Test numbering (#1977) 2023-04-04 19:29:25 +02:00
BackendGeb VampIR integration (#2103) 2023-05-22 20:18:18 +02:00
Compilation Add syntax for builtin list (#2239) 2023-07-03 13:24:56 +02:00
Core Fix bug in computeTypeInfo (#2234) 2023-06-28 16:08:12 +02:00
Examples Add a test suite for milestone examples (#1920) 2023-03-24 13:16:26 +00:00
Formatter New syntax for function definitions (#2243) 2023-07-10 19:57:55 +02:00
Internal Remove abstract (#2219) 2023-06-30 15:01:46 +02:00
Parsing Add dangling judoc error (#2099) 2023-05-16 15:39:43 +02:00
Reachability Remove abstract (#2219) 2023-06-30 15:01:46 +02:00
Runtime Use stderr for errors in the runtime (#2184) 2023-06-07 14:38:28 +02:00
Scope Named arguments (#2250) 2023-07-18 10:32:34 +01:00
Termination Move termination checker to Internal (#2209) 2023-06-20 11:02:37 +02:00
Typecheck Named arguments (#2250) 2023-07-18 10:32:34 +01:00
VampIR Switch to Halo2 for VampIR backend tests (#2216) 2023-06-21 13:08:19 +02:00
Arity.hs Support implicit arguments (#144) 2022-06-13 14:25:22 +02:00
Asm.hs Translation from JuvixAsm to C (#1619) 2022-12-06 11:33:20 +01:00
BackendGeb.hs End-to-end Geb compilation tests (#1942) 2023-03-29 14:02:40 +02:00
Base.hs Add juvix global project under xdg directory and other improvements (#1963) 2023-04-13 11:27:39 +02:00
Compilation.hs Pattern matching compilation (#1874) 2023-03-27 10:42:27 +02:00
Core.hs Implement core transformation let-hoisting (#2076) 2023-05-16 13:42:44 +02:00
Examples.hs Add a test suite for milestone examples (#1920) 2023-03-24 13:16:26 +00:00
Format.hs Add Semigroup instance for AnsiText (#2140) 2023-05-31 08:53:08 +01:00
Formatter.hs Add juvix format command (#1886) 2023-03-29 15:51:04 +02:00
Internal.hs Add translation from Internal to Core (#1567) 2022-11-07 14:47:56 +01:00
Main.hs VampIR integration (#2103) 2023-05-22 20:18:18 +02:00
Parsing.hs Disallow tab characters as spaces (#1523) 2022-09-07 13:59:41 +02:00
Reachability.hs Compute name dependency graph and filter unreachable definitions (#1408) 2022-07-25 18:38:44 +02:00
Runtime.hs Juvix C runtime (#1580) 2022-11-03 09:38:09 +01:00
Scope.hs [ CI ] New jobs: ormolu and hlint 2022-04-05 19:57:21 +02:00
Termination.hs Add the termination checker to the pipeline (#111) 2022-05-30 13:40:52 +02:00
Typecheck.hs Add lambda expressions to internal and add typechecking support (#1538) 2022-09-23 15:43:18 +02:00
VampIR.hs Check valid argument names in YAML (#2193) 2023-06-15 16:42:58 +02:00