1
1
mirror of https://github.com/anoma/juvix.git synced 2025-01-05 22:46:08 +03:00
juvix/tests
Paul Cadman 6894300e5a
Support module imports in Juvix REPL (#2029)
This PR adds support for importing modules from within a Juvix project
in the Juvix REPL.

The imported module is checked (parsed, arity-checked, type-checked etc)
as normal and added to the REPL session scope. Any errors during the
checking phase is reported to the user.

### Notes:

* You must load a file before using `import`. This is because the REPL
needs to know which Juvix project is active.
* You may only import modules from within the same Juvix project. 

### Examples

After launching `juvix repl`:

#### `open import`

```
Stdlib.Prelude> open import Stdlib.Data.Int.Ord
Stdlib.Prelude> 1 == 1
true
```

#### `import as`

```
Stdlib.Prelude> import Stdlib.Data.Int.Ord as Int
Stdlib.Prelude> 1 Int.== 1
true
```

#### `import`then `open`

```
Stdlib.Prelude> import Stdlib.Data.Int.Ord as Int
Stdlib.Prelude> open Int
Stdlib.Prelude> 1 == 1
true
```

#### Line-terminating semicolons are ignored:

```
Stdlib.Prelude> import Stdlib.Data.Int.Ord as Int;;;;;
Stdlib.Prelude> 1 Int.== 1
true
```

* Closes https://github.com/anoma/juvix/issues/1951

---------

Co-authored-by: Jonathan Cubides <jonathan.cubides@uib.no>
2023-05-08 12:23:15 +02:00
..
Asm New compilation pipeline (#1832) 2023-03-14 16:24:07 +01:00
benchmark Adapt benchmarks to the new pipeline (#1795) 2023-02-01 15:44:09 +01:00
Compilation Add bank example (#2037) 2023-04-27 10:56:31 +02:00
Core Add: the 'seq' builtin (>>>) (#1982) 2023-04-14 19:24:58 +02:00
examplesExpected Add a test suite for milestone examples (#1920) 2023-03-24 13:16:26 +00:00
Geb/positive Add: pragma support (#1997) 2023-04-26 15:26:13 +02:00
Internal Update to latest stdlib (#2048) 2023-05-04 17:49:10 +02:00
negative Add: pragma support (#1997) 2023-04-26 15:26:13 +02:00
positive Support module imports in Juvix REPL (#2029) 2023-05-08 12:23:15 +02:00
runtime/positive Translation from JuvixAsm to C (#1619) 2022-12-06 11:33:20 +01:00
smoke/Commands Support module imports in Juvix REPL (#2029) 2023-05-08 12:23:15 +02:00
.gitattributes Juvix C runtime (#1580) 2022-11-03 09:38:09 +01:00