Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support module imports in Juvix REPL #2029

Merged
merged 19 commits into from
May 8, 2023
Merged

Support module imports in Juvix REPL #2029

merged 19 commits into from
May 8, 2023

Conversation

paulcadman
Copy link
Collaborator

@paulcadman paulcadman commented Apr 25, 2023

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

importthen 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

@paulcadman paulcadman added enhancement New feature or request repl labels Apr 25, 2023
@paulcadman paulcadman added this to the 0.3.3 milestone Apr 25, 2023
@paulcadman paulcadman self-assigned this Apr 25, 2023
@paulcadman paulcadman marked this pull request as ready for review April 25, 2023 17:04
@janmasrovira janmasrovira self-requested a review April 26, 2023 08:28
janmasrovira
janmasrovira previously approved these changes May 6, 2023
@jonaprieto jonaprieto modified the milestones: 0.3.3 , 0.3.4 May 8, 2023
@jonaprieto jonaprieto modified the milestones: 0.3.4, 0.3.3 May 8, 2023
@jonaprieto jonaprieto merged commit 6894300 into main May 8, 2023
@jonaprieto jonaprieto deleted the repl-imports branch May 8, 2023 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request repl
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support open/import statements in the repl
3 participants