1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-01 00:04:58 +03:00
juvix/app
Paul Cadman 672e400a2a
Add REPL option to apply Core transformations (#1796)
Core transformations apply to the whole InfoTable, the REPL needs to
apply Core transformations to the single node that it compiles from the
user input string.

The solution in this commit is to:

1. Compile the input string as before to obtain a Core Node.
2. Add this Node to a copy of the Core InfoTable for the loaded file.
3. Apply the (CLI specified) Core transformations to this InfoTable.
4. Extract the (now transformed) Node from the InfoTable.

We can think of a way to improve this, maybe when we tackle allowing the
user to make new definitions in the REPL.

As soon as compilation of pattern matching is complete we should enable
some (all?) Core transformations by default.

Example:

At the moment we get the following result in the REPL:

```
juvix repl
...
Stdlib.Prelude> 1 + 1
suc (suc zero)
```

After this commit we can turn on `nat-to-int` transformation:

```
juvix repl -t nat-to-int
Stdlib.Prelude> 1 + 1
2
```

* Part of https://github.com/anoma/juvix/issues/1531
2023-02-01 13:00:06 +00:00
..
Commands Add REPL option to apply Core transformations (#1796) 2023-02-01 13:00:06 +00:00
TopCommand Support basic dependencies (#1622) 2022-12-20 13:05:40 +01:00
App.hs Update CI to install Smoke, Github actions, and Makefile fixes (#1735) 2023-01-24 11:50:23 +01:00
AsmInterpreter.hs Update CI to install Smoke, Github actions, and Makefile fixes (#1735) 2023-01-24 11:50:23 +01:00
CommonOptions.hs Typecheck let expressions (#1712) 2023-01-17 09:41:07 +01:00
Evaluator.hs Use absolute path in Core Evaluator to generate source file location (#1769) 2023-01-26 09:14:06 +00:00
GlobalOptions.hs Replace --output-dir flag by --internal-build-dir (#1707) 2023-01-09 15:09:02 +01:00
Main.hs Compiler output (#1705) 2023-01-06 17:54:13 +01:00
Root.hs Compiler output (#1705) 2023-01-06 17:54:13 +01:00
TopCommand.hs Update CI to install Smoke, Github actions, and Makefile fixes (#1735) 2023-01-24 11:50:23 +01:00