mirror of
https://github.com/anoma/juvix.git
synced 2024-12-13 11:16:48 +03:00
6894300e5a
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> |
||
---|---|---|
.. | ||
Empty.juvix | ||
Foo.juvix | ||
juvix.yaml |