* Fix VS Code extension Nix build
* Regenerate the 3 `node2nix` files with a more recent `node2nix`
* Add the missing `vsce` dependency
* Pass the `--development` flag to `node2nix` to correctly include dev
dependencies like `typescript` or `vsce`
* Use the verbose form of `tsc` parameters in `package.json`
* Add `node2nix`, `markdownlint` and `nodejs` to the dev shell
* Add a `README.md` to the VS Code extension directory
Close https://github.com/tweag/nickel/issues/893
This commit split the previous monolithic type `Types` into separate
kinds, types, record row types, and enum row types, to forbid the
representation of ill-formed types that was previously possible.
The change required reworking a lot of type-related functions as well as
changing the API of `types` and `typechecking` in particular, but the
result seems to be more readable and better organized.
* Add `RecordData` struct
Currently `Term::Record` and `Term::RecRecord` share two fields, and
some upcoming work on polymorphic record contracts will likely add a
third. To pre-empt this, this commit adds a `RecordData` struct, which
holds the shared fields & will be used by both `Term` variants.
* Refactor `Term::Record` to use new `RecordData` struct
This is just a mechanical update of the code, without any consideration
of what the ideal interface for using this new type might be.
* Refactor `Term::RecRecord` to use new `RecordData` struct
As with the previous commit, this is a basic mechanical update of the
code to use the new type.
* Add `RecordData::with_fields` constructor
* Add `RecordData::new` constructor
* Add `map_fields` and `filter_map_fields` functions to `RecordData`
These provide a consistent API for actions that occur multiple times
within the codebase - namely, iterating through a record and building a
new record using the values of each field, while optionally also
filtering certain fields out.
This allows the fields to be updated without exposing information about
the rest of the `RecordData` struct to consumers, which should make it
easier to change it in the future.
* Remove unnecessary top-level bindings
* Replace `RecordData::filter_map_fields` with specialised function
Previously `filter_map_fields` was only used for one thing: removing
empty optional values from fields while iterating. This replaces that
function with a more specialised function `map_fields_without_optionals`
which is defined in an extension on `RecordData` in the module where
it's actually needed.