mirror of
https://github.com/anoma/juvix.git
synced 2024-12-03 09:41:10 +03:00
7c039d687b
* Closes #2147 Adds a `specialize` pragma which allows to specify (explicit) arguments considered for specialization. Whenever a function is applied to a constant known value for the specialized argument, a new version of the function will be created with the argument pasted in. For example, the code ```juvix {-# specialize: [1] #-} mymap : {A B : Type} -> (A -> B) -> List A -> List B; mymap f nil := nil; mymap f (x :: xs) := f x :: mymap f xs; main : Nat; main := length (mymap λ{x := x + 3} (1 :: 2 :: 3 :: 4 :: nil)); ``` will be transformed into code equivalent to ```juvix mymap' : (Nat -> Nat) -> List Nat -> List Nat; mymap' f nil := nil; mymap' f (x :: xs) := λ{x := x + 3} x :: mymap' xs; main : Nat; main := length (mymap' (1 :: 2 :: 3 :: 4 :: nil)); ``` |
||
---|---|---|
.. | ||
Asm | ||
benchmark | ||
Compilation | ||
Core | ||
examplesExpected | ||
Geb/positive | ||
Internal | ||
negative | ||
positive | ||
runtime/positive | ||
smoke/Commands | ||
VampIR | ||
.gitattributes |