1.5.0
Nickel 1.5 is a major release (albeit not literally), with new core language features and improved LSP. In particular, Nickel 1.5 introduces:
- Full blown pattern matching. Patterns were previously restricted to destructuring let-bindings. They can now be used within match expressions as well (which only supported simple enum tags before).
- Enum variants. Enum variants are a new language construct. Enum variants are enum tags with associated data (they are applied to an argument). They can be seen as form of algebraic data types (ADT). Patterns, enum types, typechecking and other parts of the language are extended accordingly to support them.
- Background evaluation in the LSP. The LSP now performs evaluation of the current document in the background to report evaluation errors directly in your editor, and in particular contract errors.
- A new section of the manual on writing modular configurations.
Please refer to the manual for more details on those new features.
Core language
- Allow metadata keywords in field position by @yannham in #1768
- Support other bases than decimal for num literals by @yannham in #1798
- Enum variants:
- Structural ADTs: first step by @yannham in #1770
- Implement equality on ADTs by @yannham in #1787
- Fix laziness closurization bug, add support for ADTs by @yannham in #1789
- ADT destructuring by @yannham in #1812
- Enum tag destructuring by @yannham in #1813
- Implement ADT contracts by @yannham in #1821
- Introduce application syntax for ADTs by @yannham in #1825
- Relax enum row conflicts by @yannham in #1831
- Properly force enum variants by @yannham in #1835
- Fix enum contract stripping unwrapping variant argument by @yannham in #1833
- Pattern matching:
- [Refactor] Pattern matching by @yannham in #1799
- Record pattern compilation by @yannham in #1816
- Enum pattern compilation by @yannham in #1817
- [Refactor] Pattern positions by @yannham in #1819
- Full pattern matching by @yannham in #1820
- Support pattern contracts in match statement by @yannham in #1823
- Fix the semantics of default values in patterns by @yannham in #1826
- Specialized pattern compilation for enum tags by @yannham in #1846
Stdlib
- Add
array.zip_with
andarray.map_with_index
to the standard library by @vkleen in #1797 - fixed std.array.split_at behavior at right boundary. by @suimong in #1803
- Update stdlib for ADTs by @yannham in #1822
Tooling
- LSP: Add "goto definition" support for the import term by @jneem in #1756
- LSP: Add support for NICKEL_IMPORT_PATH environment variable @jneem in #1795
- LSP: Improved reference-finding by @jneem in #1800
- LSP: rename action by @jneem in #1811
- LSP: evaluation in the background by @jneem in #1814
- LSP: Improve document symbols by @jneem in #1848
- Add more spacing to contract error messages by @yannham in #1767
- Proper error message for non exhaustive match by @yannham in #1772
- Add InvalidContractError by @yannham in #1824
Documentation
- Add patterns to the syntax section of the manual by @yannham in #1832
- Improve the description of identifier syntax in the manual by @vkleen in #1839
- Add subsection on enum types in the manual by @yannham in #1836
- Fix old CLI syntax in documentation by @cydparser in #1844
- Add manual section on modular configurations by @yannham in #1841
- Update/refresh examples using latest Nickel idioms by @yannham in #1849
Fixes
- Check if stderr is a terminal for error messages by @vkleen in #1766
- correctly drop Array::IntoIter by @Radvendii in #1773
- LSP: vendor codespan, and fix character offset issues by @jneem in #1793
- [Fix & Refactor] Row conflict error by @yannham in #1808
- Fix unbound identifier when querying in REPL by @yannham in #1843
- Fix --field not applying pending contracts by @yannham in #1778
New Contributors
- @cydparser made their first contribution in #1844
Full Changelog: 1.4.1...1.5.0