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

Update juvix init to generate Package.juvix instead of juvix.yaml #2485

Closed
paulcadman opened this issue Oct 31, 2023 · 0 comments · Fixed by #2483
Closed

Update juvix init to generate Package.juvix instead of juvix.yaml #2485

paulcadman opened this issue Oct 31, 2023 · 0 comments · Fixed by #2483
Assignees
Labels
dev-tools enhancement New feature or request
Milestone

Comments

@paulcadman
Copy link
Collaborator

Currently juvix init generates a juvix.yaml package file. Now that:

is merged, juvix init should generate a Package.juvix file instead.

@paulcadman paulcadman added enhancement New feature or request pending-review labels Oct 31, 2023
@paulcadman paulcadman self-assigned this Oct 31, 2023
@paulcadman paulcadman added this to the 0.5.4 milestone Oct 31, 2023
paulcadman added a commit that referenced this issue Nov 3, 2023
)

`juvix init` now generates a `Package.juvix` file in the current
directory instead of a `juvix.yaml` file. It uses the prompts from the
user to fill in the name and version options.

### Validity check

After the file is generated, the Juvix project in the current directory
is loaded to check that the generated file is valid.

### Version support

Each version of the PackageDescription module must have a corresponding
[PackageDescriptionType](https://github.com/anoma/juvix/blob/c39c27000c99e6053dce83a34fca7c9f66b6c605/src/Juvix/Compiler/Pipeline/Package/Loader/Versions.hs#L12)
which defines:

* The path relative to `include/package` that the file exists at (e.g
`PackageDescription/V1.juvix`)
* The name of the Package type in the file (e.g `Package`)
* A function that translates a Package type into a Concrete function
definition that represents the code that is generated in the
`Package.juvix`
* A function that returns a Bool that determines if the generated
function definition depends on the standard library. (i.e that the
standard library needs to be imported by Package.juvix).

The last point is necessary because in the V1 spec, the `SemVer` type
uses `Maybe` to encode the release and meta components of the of the
version:

```
package : Package :=
  defaultPackage
    {name := "dd";
     version := mkVersion 1 2 3 {just "prerel"} {just "meta"}};
```

So if the user specifies a release or meta component in their version -
then the standard library needs to be imported to provide the `just`
constructor. If the user only specifies major, minor and patch
components then the standard library does not need to be imported.

* Closes #2485
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev-tools enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants