From 22ba8f15fd1357cc899c0ff75a97f9d0ae242311 Mon Sep 17 00:00:00 2001 From: Jonathan Cubides Date: Tue, 21 Mar 2023 20:01:48 +0100 Subject: [PATCH] Add new README and md files (#1904) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In this PR, I have updated the README file to reflect the new goals of the project and highlight related products to Juvix. The ORG files have been replaced with Markdown for better readability and maintainability. Additionally, I have added a couple of files to fine-tune the mdbook settings. These changes, I believe, will make it easier for users to understand and contribute to the project.🤞 - Closes #1878 - New pre-commit hook to format md, yaml, js, CSS files. To check the website generation, I have deployed the result here: Work in progress. - https://jonaprieto.github.io/juvix - https://github.com/jonaprieto/juvix --------- Co-authored-by: Paul Cadman Co-authored-by: Christopher Goes Co-authored-by: Jan Mas Rovira --- .github/ISSUE_TEMPLATE/bug_report.md | 11 +- .github/ISSUE_TEMPLATE/feature_request.md | 5 +- .github/workflows/ci.yml | 23 +- .github/workflows/linux-static-binary.yaml | 4 +- .gitignore | 11 +- .hlint.yaml | 106 +- .pre-commit-config.yaml | 25 +- .pre-commit-hooks.yaml | 10 +- CHANGELOG.md | 1388 +++++++++++++++ CONTRIBUTING.md | 64 + LICENSE => LICENSE.md | 2 + Makefile | 68 +- README.md | 144 ++ README.org | 84 - book.toml | 57 +- changelog.org | 1528 ----------------- docker/README.md | 8 +- docs/SUMMARY.md | 53 + docs/about/community.md | 8 + docs/about/team.md | 1 + docs/changelog.md | 1388 +++++++++++++++ docs/examples/README.md | 15 + docs/explanations/totality/README.md | 1 + docs/explanations/totality/coverage.md | 1 + docs/explanations/totality/positive.md | 1 + docs/explanations/totality/termination.md | 29 + docs/explanations/typetheory.md | 1 + docs/howto/compilation.md | 51 + docs/howto/installing.md | 135 ++ docs/howto/judoc.md | 1 + .../{org/notes/README.org => notes/README.md} | 0 docs/notes/builtins.md | 82 + docs/notes/lsp.md | 16 + docs/notes/monomorphization.md | 228 +++ docs/notes/runtime-benchmark-results.md | 343 ++++ docs/notes/strictly-positive-data-types.md | 77 + docs/org/SUMMARY.org | 45 - docs/org/about/community.org | 7 - docs/org/about/team.org | 1 - docs/org/examples/README.org | 13 - .../org/explanations/totality/termination.org | 26 - docs/org/howto/compilation.org | 41 - docs/org/howto/installing.org | 119 -- docs/org/notes/builtins.org | 68 - docs/org/notes/lsp.org | 12 - docs/org/notes/monomorphization.org | 183 -- docs/org/notes/runtime-benchmark-results.org | 326 ---- .../notes/strictly-positive-data-types.org | 71 - docs/org/reference/examples.org | 8 - docs/org/reference/language/README.org | 7 - docs/org/reference/language/axioms.org | 15 - docs/org/reference/language/builtins.org | 30 - docs/org/reference/language/comments.org | 17 - docs/org/reference/language/control.org | 27 - docs/org/reference/language/datatypes.org | 50 - docs/org/reference/language/functions.org | 88 - docs/org/reference/language/let.org | 16 - docs/org/reference/language/modules.org | 173 -- docs/org/reference/stdlib.org | 2 - docs/org/reference/tooling/CLI.org | 106 -- docs/org/reference/tooling/README.org | 4 - docs/org/reference/tooling/doctor.org | 93 - docs/org/reference/tooling/emacs.org | 52 - docs/org/reference/tooling/testing.org | 20 - docs/org/tutorials/README.org | 1 - docs/org/tutorials/emacs.org | 78 - docs/org/tutorials/learn.org | 517 ------ docs/org/tutorials/nodejs-interop.org | 108 -- docs/{org/quick-start.org => quick-start.md} | 66 +- docs/reference/benchmarks.md | 1 + docs/reference/examples.md | 10 + docs/reference/judoc.md | 1 + docs/reference/language/README.md | 7 + docs/reference/language/axioms.md | 16 + docs/reference/language/builtins.md | 30 + docs/reference/language/comments.md | 19 + docs/reference/language/control.md | 34 + docs/reference/language/datatypes.md | 57 + docs/reference/language/functions.md | 93 + docs/reference/language/let.md | 18 + docs/reference/language/modules.md | 166 ++ docs/reference/stdlib.md | 2 + docs/reference/tooling/CLI.md | 89 + docs/reference/tooling/README.md | 4 + docs/reference/tooling/doctor.md | 123 ++ docs/reference/tooling/emacs.md | 52 + docs/reference/tooling/testing.md | 20 + docs/tutorials/README.md | 1 + docs/tutorials/emacs.md | 79 + docs/tutorials/learn.md | 792 +++++++++ docs/tutorials/nodejs-interop.md | 101 ++ .../structure.org => tutorials/structure.md} | 0 .../vscode.org => tutorials/vscode.md} | 24 +- examples/milestone/TicTacToe/TicTacToe.juvix | 1 - package.yaml | 245 +-- theme/index.hbs | 317 ++++ theme/latex-macros.txt | 0 theme/pagetoc.css | 57 + theme/pagetoc.js | 58 + 99 files changed, 6526 insertions(+), 4250 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 CONTRIBUTING.md rename LICENSE => LICENSE.md (99%) create mode 100644 README.md delete mode 100644 README.org delete mode 100644 changelog.org create mode 100644 docs/SUMMARY.md create mode 100644 docs/about/community.md create mode 100644 docs/about/team.md create mode 100644 docs/changelog.md create mode 100644 docs/examples/README.md create mode 100644 docs/explanations/totality/README.md create mode 100644 docs/explanations/totality/coverage.md create mode 100644 docs/explanations/totality/positive.md create mode 100644 docs/explanations/totality/termination.md create mode 100644 docs/explanations/typetheory.md create mode 100644 docs/howto/compilation.md create mode 100644 docs/howto/installing.md create mode 100644 docs/howto/judoc.md rename docs/{org/notes/README.org => notes/README.md} (100%) create mode 100644 docs/notes/builtins.md create mode 100644 docs/notes/lsp.md create mode 100644 docs/notes/monomorphization.md create mode 100644 docs/notes/runtime-benchmark-results.md create mode 100644 docs/notes/strictly-positive-data-types.md delete mode 100644 docs/org/SUMMARY.org delete mode 100644 docs/org/about/community.org delete mode 100644 docs/org/about/team.org delete mode 100644 docs/org/examples/README.org delete mode 100644 docs/org/explanations/totality/termination.org delete mode 100644 docs/org/howto/compilation.org delete mode 100644 docs/org/howto/installing.org delete mode 100644 docs/org/notes/builtins.org delete mode 100644 docs/org/notes/lsp.org delete mode 100644 docs/org/notes/monomorphization.org delete mode 100644 docs/org/notes/runtime-benchmark-results.org delete mode 100644 docs/org/notes/strictly-positive-data-types.org delete mode 100644 docs/org/reference/examples.org delete mode 100644 docs/org/reference/language/README.org delete mode 100644 docs/org/reference/language/axioms.org delete mode 100644 docs/org/reference/language/builtins.org delete mode 100644 docs/org/reference/language/comments.org delete mode 100644 docs/org/reference/language/control.org delete mode 100644 docs/org/reference/language/datatypes.org delete mode 100644 docs/org/reference/language/functions.org delete mode 100644 docs/org/reference/language/let.org delete mode 100644 docs/org/reference/language/modules.org delete mode 100644 docs/org/reference/stdlib.org delete mode 100644 docs/org/reference/tooling/CLI.org delete mode 100644 docs/org/reference/tooling/README.org delete mode 100644 docs/org/reference/tooling/doctor.org delete mode 100644 docs/org/reference/tooling/emacs.org delete mode 100644 docs/org/reference/tooling/testing.org delete mode 100644 docs/org/tutorials/README.org delete mode 100644 docs/org/tutorials/emacs.org delete mode 100644 docs/org/tutorials/learn.org delete mode 100644 docs/org/tutorials/nodejs-interop.org rename docs/{org/quick-start.org => quick-start.md} (55%) create mode 100644 docs/reference/benchmarks.md create mode 100644 docs/reference/examples.md create mode 100644 docs/reference/judoc.md create mode 100644 docs/reference/language/README.md create mode 100644 docs/reference/language/axioms.md create mode 100644 docs/reference/language/builtins.md create mode 100644 docs/reference/language/comments.md create mode 100644 docs/reference/language/control.md create mode 100644 docs/reference/language/datatypes.md create mode 100644 docs/reference/language/functions.md create mode 100644 docs/reference/language/let.md create mode 100644 docs/reference/language/modules.md create mode 100644 docs/reference/stdlib.md create mode 100644 docs/reference/tooling/CLI.md create mode 100644 docs/reference/tooling/README.md create mode 100644 docs/reference/tooling/doctor.md create mode 100644 docs/reference/tooling/emacs.md create mode 100644 docs/reference/tooling/testing.md create mode 100644 docs/tutorials/README.md create mode 100644 docs/tutorials/emacs.md create mode 100644 docs/tutorials/learn.md create mode 100644 docs/tutorials/nodejs-interop.md rename docs/{org/tutorials/structure.org => tutorials/structure.md} (100%) rename docs/{org/tutorials/vscode.org => tutorials/vscode.md} (68%) create mode 100644 theme/index.hbs create mode 100644 theme/latex-macros.txt create mode 100644 theme/pagetoc.css create mode 100644 theme/pagetoc.js diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index b73fd70f0..b432c5d11 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,21 +1,22 @@ --- name: Bug report about: Create a report to help us improve -title: '' +title: "" labels: bug, pending-review -assignees: '' - +assignees: "" --- **Describe the bug** A clear and concise description of what the bug is. **Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Juvix Version [e.g. 22] + +- OS: [e.g. iOS] +- Juvix Version [e.g. 22] **To Reproduce** Steps to reproduce the behavior: + 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 634472179..1c8cc06e0 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,10 +1,9 @@ --- name: Feature request about: Suggest an idea for this project -title: '' +title: "" labels: enhancement, pending-review -assignees: '' - +assignees: "" --- **Is your feature request related to a problem? Please describe.** diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 469e8dbfa..b62614fd8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,5 @@ name: The Juvix compiler CI -'on': +"on": workflow_dispatch: inputs: ref: @@ -18,20 +18,19 @@ name: The Juvix compiler CI - synchronize - ready_for_review concurrency: - group: '${{ github.workflow }}-${{ github.head_ref || github.run_id }}' + group: "${{ github.workflow }}-${{ github.head_ref || github.run_id }}" cancel-in-progress: true env: SKIP: ormolu jobs: - pre-commit: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: "3.11" - uses: pre-commit/action@v3.0.0 clang-format: @@ -40,7 +39,7 @@ jobs: - uses: actions/checkout@v3 - uses: jidicula/clang-format-action@v4.10.1 with: - clang-format-version: '15' + clang-format-version: "15" check-path: runtime/src ormolu: @@ -71,13 +70,13 @@ jobs: path: | C:/Program Files/LLVM ./llvm - key: '${{ runner.os }}-llvm-13' + key: "${{ runner.os }}-llvm-13" - name: Install LLVM and Clang uses: KyleMayes/install-llvm-action@v1 with: - version: '13.0' - cached: '${{ steps.cache-llvm.outputs.cache-hit }}' + version: "13.0" + cached: "${{ steps.cache-llvm.outputs.cache-hit }}" - name: Download and extract wasi-sysroot run: > @@ -191,13 +190,13 @@ jobs: path: | C:/Program Files/LLVM ./llvm - key: '${{ runner.os }}-llvm-13' + key: "${{ runner.os }}-llvm-13" - name: Install LLVM and Clang uses: KyleMayes/install-llvm-action@v1 with: - version: '13.0' - cached: '${{ steps.cache-llvm.outputs.cache-hit }}' + version: "13.0" + cached: "${{ steps.cache-llvm.outputs.cache-hit }}" - name: Build the mdbook run: | @@ -227,7 +226,7 @@ jobs: - name: Deploy HTML to github pages uses: peaceiris/actions-gh-pages@v3 with: - github_token: '${{ secrets.GITHUB_TOKEN }}' + github_token: "${{ secrets.GITHUB_TOKEN }}" publish_dir: main/book/html enable_jekyll: false cname: docs.juvix.org diff --git a/.github/workflows/linux-static-binary.yaml b/.github/workflows/linux-static-binary.yaml index 42f9e6c21..23a9914d8 100644 --- a/.github/workflows/linux-static-binary.yaml +++ b/.github/workflows/linux-static-binary.yaml @@ -4,9 +4,9 @@ on: workflow_dispatch: inputs: ref: - description: 'the repository ref to build' + description: "the repository ref to build" required: true - default: 'main' + default: "main" jobs: build: diff --git a/.gitignore b/.gitignore index aaf2aa1a6..b8d28e9c7 100644 --- a/.gitignore +++ b/.gitignore @@ -65,8 +65,10 @@ agda2hs/ docs/*.html *.cabal /src/Juvix/Utils/OldParser.hs -CHANGELOG.md -UPDATES-FOR-CHANGELOG.org +docs/CHANGELOG.md +docs/CONTRIBUTING.md +docs/LICENSE.md +docs/README.md .juvix-build # C Code generation @@ -74,16 +76,13 @@ UPDATES-FOR-CHANGELOG.org *.s *.wasm *.exe -docs/md/ -_docs -docs/**/*.md +book/* **/html/* *.cmi *.cmx *.cmo .history -docs/org/README.org # Binary files (produced by `make check`) examples/milestone/HelloWorld/HelloWorld hie.yaml diff --git a/.hlint.yaml b/.hlint.yaml index 7d98555b6..587f8b0eb 100644 --- a/.hlint.yaml +++ b/.hlint.yaml @@ -7,48 +7,48 @@ # ------------------------------------------------------------------------------ - extensions: - - default: false - - name: - - ApplicativeDo - - DataKinds - - DerivingStrategies - - GADTs - - ImportQualifiedPost - - LambdaCase - - NoImplicitPrelude - - OverloadedStrings - - QuasiQuotes - - RecordWildCards - - StandaloneKindSignatures - - TemplateHaskell - - TypeFamilyDependencies - - UndecidableInstances - - UnicodeSyntax - - GeneralizedNewtypeDeriving + - default: false + - name: + - ApplicativeDo + - DataKinds + - DerivingStrategies + - GADTs + - ImportQualifiedPost + - LambdaCase + - NoImplicitPrelude + - OverloadedStrings + - QuasiQuotes + - RecordWildCards + - StandaloneKindSignatures + - TemplateHaskell + - TypeFamilyDependencies + - UndecidableInstances + - UnicodeSyntax + - GeneralizedNewtypeDeriving - flags: - - default: false - - name: - - -Wall - - -Wcompat - - -Wderiving-defaults - - -Widentities - - -Wincomplete-patterns - - -Wincomplete-record-updates - - -Wincomplete-uni-patterns - - -Wmissing-deriving-strategies - - -Wredundant-constraints - - -O2 -flate-specialise -fspecialise-aggressively + - default: false + - name: + - -Wall + - -Wcompat + - -Wderiving-defaults + - -Widentities + - -Wincomplete-patterns + - -Wincomplete-record-updates + - -Wincomplete-uni-patterns + - -Wmissing-deriving-strategies + - -Wredundant-constraints + - -O2 -flate-specialise -fspecialise-aggressively - modules: - # if you import Data.Set qualified, it must be as 'Set' - - {name: [Data.Set, Data.HashSet], as: Set} - - {name: [Data.Map, Data.HashMap.Strict, Data.HashMap.Lazy], as: Map} + # if you import Data.Set qualified, it must be as 'Set' + - { name: [Data.Set, Data.HashSet], as: Set } + - { name: [Data.Map, Data.HashMap.Strict, Data.HashMap.Lazy], as: Map } # - {name: Control.Arrow, within: []} # Certain modules are banned entirely - functions: - - {name: Data.List.NonEmpty.nub, within: []} - - {name: Data.List.NonEmpty.nubBy, within: []} + - { name: Data.List.NonEmpty.nub, within: [] } + - { name: Data.List.NonEmpty.nubBy, within: [] } # ------------------------------------------------------------------------------ # OTHER HINTS @@ -60,25 +60,29 @@ # HINTS # ------------------------------------------------------------------------------ -- error: {lhs: idea Warning, rhs: warn} -- error: {lhs: idea Suggestion, rhs: suggest} -- error: {lhs: ideaN Warning, rhs: warnN} -- error: {lhs: ideaN Suggestion, rhs: suggestN} +- error: { lhs: idea Warning, rhs: warn } +- error: { lhs: idea Suggestion, rhs: suggest } +- error: { lhs: ideaN Warning, rhs: warnN } +- error: { lhs: ideaN Suggestion, rhs: suggestN } -- error: {lhs: occNameString (occName (unLoc x)), rhs: rdrNameStr x} -- error: {lhs: occNameString (occName x), rhs: occNameStr x} -- error: {lhs: noLoc (HsVar noExtField (noLoc (mkRdrUnqual (mkVarOcc x)))), rhs: strToVar x} +- error: { lhs: occNameString (occName (unLoc x)), rhs: rdrNameStr x } +- error: { lhs: occNameString (occName x), rhs: occNameStr x } +- error: + { + lhs: noLoc (HsVar noExtField (noLoc (mkRdrUnqual (mkVarOcc x)))), + rhs: strToVar x, + } # ------------------------------------------------------------------------------ # IGNORES # ------------------------------------------------------------------------------ -- ignore: {name: Use let, within: [Test.All]} -- ignore: {name: Use String} -- ignore: {name: Avoid restricted qualification} -- ignore: {name: Redundant multi-way if} -- ignore: {name: Redundant bracket} -- ignore: {name: Eta reduce} -- ignore: {name: Avoid restricted alias} -- ignore: {name: Use tuple-section} -- ignore: {name: Use map with tuple-section} +- ignore: { name: Use let, within: [Test.All] } +- ignore: { name: Use String } +- ignore: { name: Avoid restricted qualification } +- ignore: { name: Redundant multi-way if } +- ignore: { name: Redundant bracket } +- ignore: { name: Eta reduce } +- ignore: { name: Avoid restricted alias } +- ignore: { name: Use tuple-section } +- ignore: { name: Use map with tuple-section } diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 044b53785..ceee3db10 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,20 +4,27 @@ # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: -- repo: https://github.com/pre-commit/pre-commit-hooks + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 hooks: - - id: trailing-whitespace + - id: trailing-whitespace exclude: tests/ - - id: end-of-file-fixer + - id: end-of-file-fixer exclude: tests/|assets/ - - id: check-yaml - - id: check-added-large-files - - id: check-case-conflict - - id: mixed-line-ending + - id: check-yaml + - id: check-added-large-files + - id: check-case-conflict + - id: mixed-line-ending exclude: tests/ -- repo: https://github.com/anoma/juvix + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v3.0.0-alpha.6 + hooks: + - id: prettier + types_or: [css, javascript, markdown, yaml, toml] + exclude: examples/|tests/|assets/ + + - repo: https://github.com/anoma/juvix rev: v0.2.9 hooks: - - id: ormolu + - id: ormolu diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 241a939df..9458e4738 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,5 +1,5 @@ -- id: ormolu - name: ormolu - description: Run Ormolu linter - entry: make check-ormolu - language: system +- id: ormolu + name: ormolu + description: Run Ormolu linter + entry: make check-ormolu + language: system diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..caf7b02c7 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,1388 @@ +# Changelog + + +Juvix Mascot + + +## [v0.3.0](https://github.com/anoma/juvix/tree/v0.3.0) (2023-03-15) + +[Full Changelog](https://github.com/anoma/juvix/compare/v0.2.9...v0.3.0) + +**Implemented enhancements:** + +- Avoid line breaks in applications within a type signature + [#1850](https://github.com/anoma/juvix/issues/1850) + ([paulcadman](https://github.com/paulcadman)) +- Respect user's spacing decisions in the formatter + [#1837](https://github.com/anoma/juvix/issues/1837) + ([janmasrovira](https://github.com/janmasrovira)) +- Formatter should not transform ASCII symbols to unicode by default + [#1827](https://github.com/anoma/juvix/issues/1827) + ([janmasrovira](https://github.com/janmasrovira)) +- Enable match-to-case, nat-to-int and convert-builtins by default in + REPL [#1825](https://github.com/anoma/juvix/issues/1825) + ([lukaszcz](https://github.com/lukaszcz)) +- The Juvix formatter works poorly with multi-line ifs + [#1793](https://github.com/anoma/juvix/issues/1793) + ([janmasrovira](https://github.com/janmasrovira)) +- Add a lazy IO sequencing function (#1772) + [#1773](https://github.com/anoma/juvix/issues/1773) + ([lukaszcz](https://github.com/lukaszcz)) +- Support LetRec in the GEB backend + [#1756](https://github.com/anoma/juvix/issues/1756) + ([janmasrovira](https://github.com/janmasrovira)) +- Support integers in the GEB backend + [#1753](https://github.com/anoma/juvix/issues/1753) + ([lukaszcz](https://github.com/lukaszcz)) +- GEB evaluator [#1751](https://github.com/anoma/juvix/issues/1751) + ([jonaprieto](https://github.com/jonaprieto)) +- Add debugging builtin functions + [#1731](https://github.com/anoma/juvix/issues/1731) + ([jonaprieto](https://github.com/jonaprieto)) +- Non-judoc comments are removed when generating HTML output + [#1723](https://github.com/anoma/juvix/issues/1723) + ([janmasrovira](https://github.com/janmasrovira)) +- Special syntax for `case` + [#1716](https://github.com/anoma/juvix/issues/1716) + ([janmasrovira](https://github.com/janmasrovira)) +- Make \|\| and && lazy + [#1701](https://github.com/anoma/juvix/issues/1701) + ([lukaszcz](https://github.com/lukaszcz)) +- It should be possible to specify multiple implicit type arguments at + once [#1692](https://github.com/anoma/juvix/issues/1692) + ([janmasrovira](https://github.com/janmasrovira)) +- Naive compilation of complex pattern matches with match-expressions + to decision trees with case-expressions + [#1531](https://github.com/anoma/juvix/issues/1531) + ([paulcadman](https://github.com/paulcadman)) +- New compilation pipeline + [#1832](https://github.com/anoma/juvix/pull/1832) + ([lukaszcz](https://github.com/lukaszcz)) +- Add internal core-eval option to evaluate named function identifier + [#1819](https://github.com/anoma/juvix/pull/1819) + ([paulcadman](https://github.com/paulcadman)) +- Short syntax for sequences of function and datatype parameters + [#1809](https://github.com/anoma/juvix/pull/1809) + ([lukaszcz](https://github.com/lukaszcz)) +- Add Geb Backend Evaluator with some extra subcommands + [#1808](https://github.com/anoma/juvix/pull/1808) + ([jonaprieto](https://github.com/jonaprieto)) +- Add REPL option to apply Core transformations + [#1796](https://github.com/anoma/juvix/pull/1796) + ([paulcadman](https://github.com/paulcadman)) +- String builtins [#1784](https://github.com/anoma/juvix/pull/1784) + ([lukaszcz](https://github.com/lukaszcz)) +- Use restore/save github action to speed up the CI testing + [#1783](https://github.com/anoma/juvix/pull/1783) + ([jonaprieto](https://github.com/jonaprieto)) +- Fix minor issue with ==% for type equality + [#1780](https://github.com/anoma/juvix/pull/1780) + ([jonaprieto](https://github.com/jonaprieto)) +- Add debugging builtin functions `trace` and `fail` + [#1771](https://github.com/anoma/juvix/pull/1771) + ([jonaprieto](https://github.com/jonaprieto)) +- Keep regular comments in html output + [#1766](https://github.com/anoma/juvix/pull/1766) + ([janmasrovira](https://github.com/janmasrovira)) +- Lazy boolean operators + [#1743](https://github.com/anoma/juvix/pull/1743) + ([lukaszcz](https://github.com/lukaszcz)) +- Refactor `html` command with extra options + [#1725](https://github.com/anoma/juvix/pull/1725) + ([jonaprieto](https://github.com/jonaprieto)) +- Add initial setup for codespaces + [#1713](https://github.com/anoma/juvix/pull/1713) + ([jonaprieto](https://github.com/jonaprieto)) +- Typecheck let expressions + [#1712](https://github.com/anoma/juvix/pull/1712) + ([janmasrovira](https://github.com/janmasrovira)) +- Use Smoke instead of shelltestrunner + [#1710](https://github.com/anoma/juvix/pull/1710) + ([jonaprieto](https://github.com/jonaprieto)) +- Replace –output-dir flag by –internal-build-dir + [#1707](https://github.com/anoma/juvix/pull/1707) + ([jonaprieto](https://github.com/jonaprieto)) +- Compiler output [#1705](https://github.com/anoma/juvix/pull/1705) + ([jonaprieto](https://github.com/jonaprieto)) +- Allow optional pipe before the first constructor for inductive type + declarations [#1699](https://github.com/anoma/juvix/pull/1699) + ([jonaprieto](https://github.com/jonaprieto)) +- Nat builtins [#1686](https://github.com/anoma/juvix/pull/1686) + ([lukaszcz](https://github.com/lukaszcz)) + +**Merged pull requests:** + +- Remove dead code in `Internal` + [#1891](https://github.com/anoma/juvix/pull/1891) + ([janmasrovira](https://github.com/janmasrovira)) +- Remove missing Juvix examples and webapp example from docs build + [#1890](https://github.com/anoma/juvix/pull/1890) + ([paulcadman](https://github.com/paulcadman)) +- Fix type synonym in let + [#1880](https://github.com/anoma/juvix/pull/1880) + ([janmasrovira](https://github.com/janmasrovira)) +- Update stack resolver to lts-20.12 + [#1873](https://github.com/anoma/juvix/pull/1873) + ([paulcadman](https://github.com/paulcadman)) +- Use Ape to format patterns + [#1870](https://github.com/anoma/juvix/pull/1870) + ([janmasrovira](https://github.com/janmasrovira)) +- Fix Core-To-Geb translation + [#1863](https://github.com/anoma/juvix/pull/1863) + ([jonaprieto](https://github.com/jonaprieto)) +- Remove the old C backend + [#1862](https://github.com/anoma/juvix/pull/1862) + ([lukaszcz](https://github.com/lukaszcz)) +- Move `substEnv` to its own module + [#1861](https://github.com/anoma/juvix/pull/1861) + ([janmasrovira](https://github.com/janmasrovira)) +- Add `_caseTypeWholeExpression` to Internal + [#1860](https://github.com/anoma/juvix/pull/1860) + ([janmasrovira](https://github.com/janmasrovira)) +- remove old minihaskell files + [#1859](https://github.com/anoma/juvix/pull/1859) + ([jonaprieto](https://github.com/jonaprieto)) +- Fix bugs in the Case translation in Core-to-Geb + [#1858](https://github.com/anoma/juvix/pull/1858) + ([lukaszcz](https://github.com/lukaszcz)) +- Format examples [#1856](https://github.com/anoma/juvix/pull/1856) + ([janmasrovira](https://github.com/janmasrovira)) +- Sort the identifiers topologically in the Core-to-GEB translation + [#1854](https://github.com/anoma/juvix/pull/1854) + ([lukaszcz](https://github.com/lukaszcz)) +- Add type info to the mid-square hashing function + [#1853](https://github.com/anoma/juvix/pull/1853) + ([lukaszcz](https://github.com/lukaszcz)) +- Use APE mechanism to format Function expressions + [#1852](https://github.com/anoma/juvix/pull/1852) + ([paulcadman](https://github.com/paulcadman)) +- Preserve single wildcards pretty printing function parameters + [#1851](https://github.com/anoma/juvix/pull/1851) + ([paulcadman](https://github.com/paulcadman)) +- Add type annotation to case expression + [#1849](https://github.com/anoma/juvix/pull/1849) + ([janmasrovira](https://github.com/janmasrovira)) +- Remove module parameters + [#1848](https://github.com/anoma/juvix/pull/1848) + ([janmasrovira](https://github.com/janmasrovira)) +- Allow shadowing local variables with let function definitions + [#1847](https://github.com/anoma/juvix/pull/1847) + ([janmasrovira](https://github.com/janmasrovira)) +- Add lambda type info + [#1845](https://github.com/anoma/juvix/pull/1845) + ([janmasrovira](https://github.com/janmasrovira)) +- Improve comma formatting + [#1842](https://github.com/anoma/juvix/pull/1842) + ([janmasrovira](https://github.com/janmasrovira)) +- Improve formatter [#1840](https://github.com/anoma/juvix/pull/1840) + ([janmasrovira](https://github.com/janmasrovira)) +- Respect lambda Ascii/Unicode + [#1838](https://github.com/anoma/juvix/pull/1838) + ([janmasrovira](https://github.com/janmasrovira)) +- Fix `juvix init` [#1835](https://github.com/anoma/juvix/pull/1835) + ([janmasrovira](https://github.com/janmasrovira)) +- The formatter respects the ascii function arrow + [#1834](https://github.com/anoma/juvix/pull/1834) + ([janmasrovira](https://github.com/janmasrovira)) +- Add `dev core from-concrete` command + [#1833](https://github.com/anoma/juvix/pull/1833) + ([janmasrovira](https://github.com/janmasrovira)) +- Give proper errors for incorrect application of lazy builtins + [#1830](https://github.com/anoma/juvix/pull/1830) + ([lukaszcz](https://github.com/lukaszcz)) +- Documentation: update language reference + [#1829](https://github.com/anoma/juvix/pull/1829) + ([lukaszcz](https://github.com/lukaszcz)) +- Add compilation of complex pattern matching to case + [#1824](https://github.com/anoma/juvix/pull/1824) + ([paulcadman](https://github.com/paulcadman)) +- Apply CI ghcup workaround to docs build + [#1823](https://github.com/anoma/juvix/pull/1823) + ([paulcadman](https://github.com/paulcadman)) +- Update the Juvix tutorial for 0.3 + [#1822](https://github.com/anoma/juvix/pull/1822) + ([lukaszcz](https://github.com/lukaszcz)) +- Workaround ghcup issue on CI runner + [#1821](https://github.com/anoma/juvix/pull/1821) + ([paulcadman](https://github.com/paulcadman)) +- Respect the `juvix dev highlight --format` flag when outputting + errors [#1820](https://github.com/anoma/juvix/pull/1820) + ([janmasrovira](https://github.com/janmasrovira)) +- Comments about the usage of the JuvixCore recursors + [#1818](https://github.com/anoma/juvix/pull/1818) + ([lukaszcz](https://github.com/lukaszcz)) +- Emacs mode and VSCode extension tutorials + [#1815](https://github.com/anoma/juvix/pull/1815) + ([lukaszcz](https://github.com/lukaszcz)) +- Documentation: how to compile Juvix programs + [#1813](https://github.com/anoma/juvix/pull/1813) + ([lukaszcz](https://github.com/lukaszcz)) +- Make '\>\>' lazy [#1812](https://github.com/anoma/juvix/pull/1812) + ([lukaszcz](https://github.com/lukaszcz)) +- Output proper GEB Lisp programs + [#1810](https://github.com/anoma/juvix/pull/1810) + ([lukaszcz](https://github.com/lukaszcz)) +- Remove the usage annotation syntax + [#1805](https://github.com/anoma/juvix/pull/1805) + ([lukaszcz](https://github.com/lukaszcz)) +- Mid-square hashing implemented in JuvixCore + [#1804](https://github.com/anoma/juvix/pull/1804) + ([lukaszcz](https://github.com/lukaszcz)) +- Autocompletion for `dev core compilation --target` + [#1803](https://github.com/anoma/juvix/pull/1803) + ([janmasrovira](https://github.com/janmasrovira)) +- Special syntax for case + [#1800](https://github.com/anoma/juvix/pull/1800) + ([janmasrovira](https://github.com/janmasrovira)) +- Adapt benchmarks to the new pipeline + [#1795](https://github.com/anoma/juvix/pull/1795) + ([lukaszcz](https://github.com/lukaszcz)) +- Support letrec lifting without lambda lifting + [#1794](https://github.com/anoma/juvix/pull/1794) + ([janmasrovira](https://github.com/janmasrovira)) +- Use the reader effect + [#1791](https://github.com/anoma/juvix/pull/1791) + ([janmasrovira](https://github.com/janmasrovira)) +- Remove braces from let expressions + [#1790](https://github.com/anoma/juvix/pull/1790) + ([janmasrovira](https://github.com/janmasrovira)) +- Translate as-pattern binders to Core PatternBinders + [#1789](https://github.com/anoma/juvix/pull/1789) + ([paulcadman](https://github.com/paulcadman)) +- Fix termination with as-patterns + [#1787](https://github.com/anoma/juvix/pull/1787) + ([janmasrovira](https://github.com/janmasrovira)) +- Allow type signatures to have a body + [#1785](https://github.com/anoma/juvix/pull/1785) + ([janmasrovira](https://github.com/janmasrovira)) +- Track builtins in the Core InfoTable + [#1782](https://github.com/anoma/juvix/pull/1782) + ([paulcadman](https://github.com/paulcadman)) +- Pipes for lambda clauses + [#1781](https://github.com/anoma/juvix/pull/1781) + ([janmasrovira](https://github.com/janmasrovira)) +- Support integers in the GEB backend + [#1778](https://github.com/anoma/juvix/pull/1778) + ([lukaszcz](https://github.com/lukaszcz)) +- Add builtin nat and bool types as start nodes in reachability + analysis [#1775](https://github.com/anoma/juvix/pull/1775) + ([paulcadman](https://github.com/paulcadman)) +- Update pre-commit [#1772](https://github.com/anoma/juvix/pull/1772) + ([jonaprieto](https://github.com/jonaprieto)) +- Parse JuvixCore with absolute paths + [#1770](https://github.com/anoma/juvix/pull/1770) + ([paulcadman](https://github.com/paulcadman)) +- Use absolute path in Core Evaluator to generate source file location + [#1769](https://github.com/anoma/juvix/pull/1769) + ([paulcadman](https://github.com/paulcadman)) +- Install wasmer binary from Github releases + [#1765](https://github.com/anoma/juvix/pull/1765) + ([jonaprieto](https://github.com/jonaprieto)) +- Run the new Juvix formatter for all the Juvix examples + [#1764](https://github.com/anoma/juvix/pull/1764) + ([jonaprieto](https://github.com/jonaprieto)) +- Fix let expressions in the repl + [#1763](https://github.com/anoma/juvix/pull/1763) + ([janmasrovira](https://github.com/janmasrovira)) +- Improve arity inference for repl expressions + [#1762](https://github.com/anoma/juvix/pull/1762) + ([janmasrovira](https://github.com/janmasrovira)) +- Fix broken links and other improvements + [#1761](https://github.com/anoma/juvix/pull/1761) + ([jonaprieto](https://github.com/jonaprieto)) +- Translate Nat builtins to the correct Core Ops + [#1760](https://github.com/anoma/juvix/pull/1760) + ([paulcadman](https://github.com/paulcadman)) +- Remove hlint from the CI and pre-commit config + [#1759](https://github.com/anoma/juvix/pull/1759) + ([jonaprieto](https://github.com/jonaprieto)) +- Fix demo example build + [#1757](https://github.com/anoma/juvix/pull/1757) + ([paulcadman](https://github.com/paulcadman)) +- Basic Geb integration + [#1748](https://github.com/anoma/juvix/pull/1748) + ([lukaszcz](https://github.com/lukaszcz)) +- Fix macOS CI build [#1747](https://github.com/anoma/juvix/pull/1747) + ([paulcadman](https://github.com/paulcadman)) +- Adapt Juvix programs to the new pipeline + [#1746](https://github.com/anoma/juvix/pull/1746) + ([lukaszcz](https://github.com/lukaszcz)) +- Fix link in README for the new docs + [#1745](https://github.com/anoma/juvix/pull/1745) + ([lukaszcz](https://github.com/lukaszcz)) +- Move juvix-mode to a separate repository + [#1744](https://github.com/anoma/juvix/pull/1744) + ([jonaprieto](https://github.com/jonaprieto)) +- Print comments when pretty printing concrete syntax + [#1737](https://github.com/anoma/juvix/pull/1737) + ([janmasrovira](https://github.com/janmasrovira)) +- Demo [#1736](https://github.com/anoma/juvix/pull/1736) + ([lukaszcz](https://github.com/lukaszcz)) +- Update CI to install Smoke, Github actions, and Makefile fixes + [#1735](https://github.com/anoma/juvix/pull/1735) + ([jonaprieto](https://github.com/jonaprieto)) +- Update stack.yaml [#1734](https://github.com/anoma/juvix/pull/1734) + ([jonaprieto](https://github.com/jonaprieto)) +- Fix Nat builtins [#1733](https://github.com/anoma/juvix/pull/1733) + ([lukaszcz](https://github.com/lukaszcz)) +- Script to count LOC + [#1732](https://github.com/anoma/juvix/pull/1732) + ([lukaszcz](https://github.com/lukaszcz)) +- Give a proper type to literal Strings + [#1730](https://github.com/anoma/juvix/pull/1730) + ([paulcadman](https://github.com/paulcadman)) +- Do not filter implicit args in internal to core translation + [#1728](https://github.com/anoma/juvix/pull/1728) + ([paulcadman](https://github.com/paulcadman)) +- Fix de Brujin indexing of lambda arguments + [#1727](https://github.com/anoma/juvix/pull/1727) + ([paulcadman](https://github.com/paulcadman)) +- Fix inference loop [#1726](https://github.com/anoma/juvix/pull/1726) + ([janmasrovira](https://github.com/janmasrovira)) +- Remove wildcard patterns from Internal + [#1724](https://github.com/anoma/juvix/pull/1724) + ([janmasrovira](https://github.com/janmasrovira)) +- Restructure the documentation and add a tutorial + [#1718](https://github.com/anoma/juvix/pull/1718) + ([lukaszcz](https://github.com/lukaszcz)) +- Improve error message for confusing ':=' with '=' + [#1715](https://github.com/anoma/juvix/pull/1715) + ([lukaszcz](https://github.com/lukaszcz)) +- Fix #1704 [#1711](https://github.com/anoma/juvix/pull/1711) + ([janmasrovira](https://github.com/janmasrovira)) +- Fix #1693 [#1708](https://github.com/anoma/juvix/pull/1708) + ([janmasrovira](https://github.com/janmasrovira)) +- Tests for the new compilation pipeline + [#1703](https://github.com/anoma/juvix/pull/1703) + ([lukaszcz](https://github.com/lukaszcz)) +- Add printString and printBool support to legacy C backend + [#1698](https://github.com/anoma/juvix/pull/1698) + ([paulcadman](https://github.com/paulcadman)) +- Add –show-de-bruijn option to `juvix repl` + [#1694](https://github.com/anoma/juvix/pull/1694) + ([lukaszcz](https://github.com/lukaszcz)) +- Allow 'terminating' keyword with builtins + [#1688](https://github.com/anoma/juvix/pull/1688) + ([lukaszcz](https://github.com/lukaszcz)) +- Remove unicode cons symbol + [#1687](https://github.com/anoma/juvix/pull/1687) + ([lukaszcz](https://github.com/lukaszcz)) +- Change syntax for ind. data types and forbid the empty data type + [#1684](https://github.com/anoma/juvix/pull/1684) + ([jonaprieto](https://github.com/jonaprieto)) +- Convert Nat literals to Core integers + [#1681](https://github.com/anoma/juvix/pull/1681) + ([lukaszcz](https://github.com/lukaszcz)) +- Less verbose output from running `make check` + [#1675](https://github.com/anoma/juvix/pull/1675) + ([jonaprieto](https://github.com/jonaprieto)) +- Remove where syntax + [#1674](https://github.com/anoma/juvix/pull/1674) + ([jonaprieto](https://github.com/jonaprieto)) +- Benchmarks [#1673](https://github.com/anoma/juvix/pull/1673) + ([janmasrovira](https://github.com/janmasrovira)) +- JuvixCore to JuvixAsm translation + [#1665](https://github.com/anoma/juvix/pull/1665) + ([lukaszcz](https://github.com/lukaszcz)) + +## [v0.2.9](https://github.com/anoma/juvix/tree/v0.2.9) (2023-01-18) + +[Full Changelog](https://github.com/anoma/juvix/compare/v0.2.8...v0.2.9) + +**Implemented enhancements:** + +- Refactor `html` command with extra options + [#1725](https://github.com/anoma/juvix/pull/1725) + ([jonaprieto](https://github.com/jonaprieto)) +- Add initial setup for codespaces + [#1713](https://github.com/anoma/juvix/pull/1713) + ([jonaprieto](https://github.com/jonaprieto)) +- Typecheck let expressions + [#1712](https://github.com/anoma/juvix/pull/1712) + ([janmasrovira](https://github.com/janmasrovira)) +- Use Smoke instead of shelltestrunner + [#1710](https://github.com/anoma/juvix/pull/1710) + ([jonaprieto](https://github.com/jonaprieto)) +- Replace –output-dir flag by –internal-build-dir + [#1707](https://github.com/anoma/juvix/pull/1707) + ([jonaprieto](https://github.com/jonaprieto)) +- Compiler output [#1705](https://github.com/anoma/juvix/pull/1705) + ([jonaprieto](https://github.com/jonaprieto)) +- Allow optional pipe before the first constructor for inductive type + declarations [#1699](https://github.com/anoma/juvix/pull/1699) + ([jonaprieto](https://github.com/jonaprieto)) +- Nat builtins [#1686](https://github.com/anoma/juvix/pull/1686) + ([lukaszcz](https://github.com/lukaszcz)) + +**Merged pull requests:** + +- Demo [#1736](https://github.com/anoma/juvix/pull/1736) + ([lukaszcz](https://github.com/lukaszcz)) +- Update stack.yaml [#1734](https://github.com/anoma/juvix/pull/1734) + ([jonaprieto](https://github.com/jonaprieto)) +- Fix Nat builtins [#1733](https://github.com/anoma/juvix/pull/1733) + ([lukaszcz](https://github.com/lukaszcz)) +- Script to count LOC + [#1732](https://github.com/anoma/juvix/pull/1732) + ([lukaszcz](https://github.com/lukaszcz)) +- Give a proper type to literal Strings + [#1730](https://github.com/anoma/juvix/pull/1730) + ([paulcadman](https://github.com/paulcadman)) +- Do not filter implicit args in internal to core translation + [#1728](https://github.com/anoma/juvix/pull/1728) + ([paulcadman](https://github.com/paulcadman)) +- Fix de Brujin indexing of lambda arguments + [#1727](https://github.com/anoma/juvix/pull/1727) + ([paulcadman](https://github.com/paulcadman)) +- Fix inference loop [#1726](https://github.com/anoma/juvix/pull/1726) + ([janmasrovira](https://github.com/janmasrovira)) +- Remove wildcard patterns from Internal + [#1724](https://github.com/anoma/juvix/pull/1724) + ([janmasrovira](https://github.com/janmasrovira)) +- Restructure the documentation and add a tutorial + [#1718](https://github.com/anoma/juvix/pull/1718) + ([lukaszcz](https://github.com/lukaszcz)) +- Improve error message for confusing ':=' with '=' + [#1715](https://github.com/anoma/juvix/pull/1715) + ([lukaszcz](https://github.com/lukaszcz)) +- Fix #1704 [#1711](https://github.com/anoma/juvix/pull/1711) + ([janmasrovira](https://github.com/janmasrovira)) +- Fix #1693 [#1708](https://github.com/anoma/juvix/pull/1708) + ([janmasrovira](https://github.com/janmasrovira)) +- Tests for the new compilation pipeline + [#1703](https://github.com/anoma/juvix/pull/1703) + ([lukaszcz](https://github.com/lukaszcz)) +- Add printString and printBool support to legacy C backend + [#1698](https://github.com/anoma/juvix/pull/1698) + ([paulcadman](https://github.com/paulcadman)) +- Add –show-de-bruijn option to `juvix repl` + [#1694](https://github.com/anoma/juvix/pull/1694) + ([lukaszcz](https://github.com/lukaszcz)) +- Allow 'terminating' keyword with builtins + [#1688](https://github.com/anoma/juvix/pull/1688) + ([lukaszcz](https://github.com/lukaszcz)) +- Remove unicode cons symbol + [#1687](https://github.com/anoma/juvix/pull/1687) + ([lukaszcz](https://github.com/lukaszcz)) +- Change syntax for ind. data types and forbid the empty data type + [#1684](https://github.com/anoma/juvix/pull/1684) + ([jonaprieto](https://github.com/jonaprieto)) +- Convert Nat literals to Core integers + [#1681](https://github.com/anoma/juvix/pull/1681) + ([lukaszcz](https://github.com/lukaszcz)) +- Less verbose output from running `make check` + [#1675](https://github.com/anoma/juvix/pull/1675) + ([jonaprieto](https://github.com/jonaprieto)) +- Remove where syntax + [#1674](https://github.com/anoma/juvix/pull/1674) + ([jonaprieto](https://github.com/jonaprieto)) +- Benchmarks [#1673](https://github.com/anoma/juvix/pull/1673) + ([janmasrovira](https://github.com/janmasrovira)) +- JuvixCore to JuvixAsm translation + [#1665](https://github.com/anoma/juvix/pull/1665) + ([lukaszcz](https://github.com/lukaszcz)) + +## [v0.2.8](https://github.com/anoma/juvix/tree/v0.2.8) (2022-12-20) + +[Full Changelog](https://github.com/anoma/juvix/compare/v0.2.7...v0.2.8) + +**Implemented enhancements:** + +- Support basic dependencies + [#1622](https://github.com/anoma/juvix/pull/1622) + ([janmasrovira](https://github.com/janmasrovira)) + +**Merged pull requests:** + +- Refactor hie.yaml and add entry in the readme + [#1672](https://github.com/anoma/juvix/pull/1672) + ([janmasrovira](https://github.com/janmasrovira)) +- Fix inline monospace formatted text in README + [#1671](https://github.com/anoma/juvix/pull/1671) + ([paulcadman](https://github.com/paulcadman)) +- Pin mdbook to version 0.4.22 in docs build + [#1670](https://github.com/anoma/juvix/pull/1670) + ([paulcadman](https://github.com/paulcadman)) +- Add option to specify Core transformations to + `dev internal core-eval` + [#1669](https://github.com/anoma/juvix/pull/1669) + ([paulcadman](https://github.com/paulcadman)) +- Revert "Ignore binaries generated by running some tests" + [#1668](https://github.com/anoma/juvix/pull/1668) + ([jonaprieto](https://github.com/jonaprieto)) +- Add configuration files so the project can be built with cabal + [#1667](https://github.com/anoma/juvix/pull/1667) + ([paulcadman](https://github.com/paulcadman)) +- Add documentation for compiling/running the TicTacToe example + [#1664](https://github.com/anoma/juvix/pull/1664) + ([paulcadman](https://github.com/paulcadman)) +- Ignore binaries generated by running some tests + [#1663](https://github.com/anoma/juvix/pull/1663) + ([jonaprieto](https://github.com/jonaprieto)) +- Conversion of Nat representation to JuvixCore integers + [#1661](https://github.com/anoma/juvix/pull/1661) + ([lukaszcz](https://github.com/lukaszcz)) +- Move applications inside Lets and Cases + [#1659](https://github.com/anoma/juvix/pull/1659) + ([lukaszcz](https://github.com/lukaszcz)) +- Run shelltests on macOS build + [#1658](https://github.com/anoma/juvix/pull/1658) + ([paulcadman](https://github.com/paulcadman)) +- Restore macOS CI build/test + [#1657](https://github.com/anoma/juvix/pull/1657) + ([paulcadman](https://github.com/paulcadman)) +- Remove type arguments and type abstractions from Nodes + [#1655](https://github.com/anoma/juvix/pull/1655) + ([lukaszcz](https://github.com/lukaszcz)) +- Pretty printing of JuvixAsm code + [#1650](https://github.com/anoma/juvix/pull/1650) + ([lukaszcz](https://github.com/lukaszcz)) +- Remove NameId from Core + [#1649](https://github.com/anoma/juvix/pull/1649) + ([lukaszcz](https://github.com/lukaszcz)) +- Translation from JuvixAsm to C + [#1619](https://github.com/anoma/juvix/pull/1619) + ([lukaszcz](https://github.com/lukaszcz)) + +## [v0.2.7](https://github.com/anoma/juvix/tree/v0.2.7) (2022-12-05) + +[Full Changelog](https://github.com/anoma/juvix/compare/v0.2.6...v0.2.7) + +**Implemented enhancements:** + +- Add juvix-repl-mode for emacs + [#1612](https://github.com/anoma/juvix/pull/1612) + ([paulcadman](https://github.com/paulcadman)) +- Make lambda lifting correct when free variables occur in the types + of binders [#1609](https://github.com/anoma/juvix/pull/1609) + ([janmasrovira](https://github.com/janmasrovira)) + +**Merged pull requests:** + +- Files pure refactor + [#1652](https://github.com/anoma/juvix/pull/1652) + ([janmasrovira](https://github.com/janmasrovira)) +- Use the same stack version in all CI jobs and remove `stack setup` + step [#1651](https://github.com/anoma/juvix/pull/1651) + ([paulcadman](https://github.com/paulcadman)) +- Fix 'not a primitive type' error message + [#1648](https://github.com/anoma/juvix/pull/1648) + ([lukaszcz](https://github.com/lukaszcz)) +- Upgrade stack snapshot to use ghc-9.2.5 + [#1621](https://github.com/anoma/juvix/pull/1621) + ([janmasrovira](https://github.com/janmasrovira)) +- Add an emacs function to restart the REPL + [#1618](https://github.com/anoma/juvix/pull/1618) + ([paulcadman](https://github.com/paulcadman)) +- Add types to Core functions and constructors when translating from + Internal [#1617](https://github.com/anoma/juvix/pull/1617) + ([paulcadman](https://github.com/paulcadman)) +- Auto complete argument of 'dev core read -t' + [#1616](https://github.com/anoma/juvix/pull/1616) + ([janmasrovira](https://github.com/janmasrovira)) +- Compute new entrypoint root when loading a file in the REPL + [#1615](https://github.com/anoma/juvix/pull/1615) + ([paulcadman](https://github.com/paulcadman)) +- Compute maximum runtime stack height in JuvixReg + [#1613](https://github.com/anoma/juvix/pull/1613) + ([lukaszcz](https://github.com/lukaszcz)) +- Remove shelltest threading + [#1611](https://github.com/anoma/juvix/pull/1611) + ([paulcadman](https://github.com/paulcadman)) +- Use StackInfo and recurseS in the JuvixAsm to JuvixReg translation. + [#1610](https://github.com/anoma/juvix/pull/1610) + ([lukaszcz](https://github.com/lukaszcz)) +- Precompute maximum heap allocation + [#1608](https://github.com/anoma/juvix/pull/1608) + ([lukaszcz](https://github.com/lukaszcz)) +- Improvements to Juvix REPL + [#1607](https://github.com/anoma/juvix/pull/1607) + ([paulcadman](https://github.com/paulcadman)) +- Fix discrepancy between Juvix and WASM pages + [#1605](https://github.com/anoma/juvix/pull/1605) + ([lukaszcz](https://github.com/lukaszcz)) +- Compute JuvixAsm stack usage info + [#1604](https://github.com/anoma/juvix/pull/1604) + ([lukaszcz](https://github.com/lukaszcz)) +- Improve As-Pattern parsing + [#1603](https://github.com/anoma/juvix/pull/1603) + ([ii8](https://github.com/ii8)) +- Juvix core recursors should descend into nodes stored in infos + [#1600](https://github.com/anoma/juvix/pull/1600) + ([janmasrovira](https://github.com/janmasrovira)) +- Add docs for installing the linux binary + [#1599](https://github.com/anoma/juvix/pull/1599) + ([paulcadman](https://github.com/paulcadman)) +- Binder refactor [#1598](https://github.com/anoma/juvix/pull/1598) + ([janmasrovira](https://github.com/janmasrovira)) +- Juvix C runtime [#1580](https://github.com/anoma/juvix/pull/1580) + ([lukaszcz](https://github.com/lukaszcz)) +- As-patterns [#1576](https://github.com/anoma/juvix/pull/1576) + ([ii8](https://github.com/ii8)) +- Eta expansion at the top of each core function definition (#1481) + [#1571](https://github.com/anoma/juvix/pull/1571) + ([janmasrovira](https://github.com/janmasrovira)) +- Add translation from Internal to Core + [#1567](https://github.com/anoma/juvix/pull/1567) + ([paulcadman](https://github.com/paulcadman)) + +## [v0.2.6](https://github.com/anoma/juvix/tree/v0.2.6) (2022-10-26) + +[Full Changelog](https://github.com/anoma/juvix/compare/v0.2.5...v0.2.6) + +**Implemented enhancements:** + +- Support go to definition for the standard library + [#1592](https://github.com/anoma/juvix/pull/1592) + ([paulcadman](https://github.com/paulcadman)) +- Add builtin if [#1585](https://github.com/anoma/juvix/pull/1585) + ([paulcadman](https://github.com/paulcadman)) +- Add builtin boolean + [#1582](https://github.com/anoma/juvix/pull/1582) + ([paulcadman](https://github.com/paulcadman)) +- Add lambda expressions to internal and add typechecking support + [#1538](https://github.com/anoma/juvix/pull/1538) + ([janmasrovira](https://github.com/janmasrovira)) + +**Fixed bugs:** + +- Fix arity checker bug + [#1546](https://github.com/anoma/juvix/pull/1546) + ([janmasrovira](https://github.com/janmasrovira)) +- Look in patterns when building the dependency graph + [#1536](https://github.com/anoma/juvix/pull/1536) + ([janmasrovira](https://github.com/janmasrovira)) + +**Merged pull requests:** + +- Update language reference to match current state of Juvix + [#1594](https://github.com/anoma/juvix/pull/1594) + ([paulcadman](https://github.com/paulcadman)) +- Fix letrec printing + [#1591](https://github.com/anoma/juvix/pull/1591) + ([janmasrovira](https://github.com/janmasrovira)) +- Update stdlib submodule with builtin changes + [#1589](https://github.com/anoma/juvix/pull/1589) + ([paulcadman](https://github.com/paulcadman)) +- Rename builtin natural to nat and boolean to bool + [#1588](https://github.com/anoma/juvix/pull/1588) + ([paulcadman](https://github.com/paulcadman)) +- Improve the test for eta-expansion of constructors and builtins + [#1583](https://github.com/anoma/juvix/pull/1583) + ([lukaszcz](https://github.com/lukaszcz)) +- Properly newline expressions in the pretty printer + [#1581](https://github.com/anoma/juvix/pull/1581) + ([janmasrovira](https://github.com/janmasrovira)) +- Letrec lifting [#1579](https://github.com/anoma/juvix/pull/1579) + ([janmasrovira](https://github.com/janmasrovira)) +- Add softlines between applications and hang definitions + [#1578](https://github.com/anoma/juvix/pull/1578) + ([janmasrovira](https://github.com/janmasrovira)) +- Parse optional type info in JVC files + [#1575](https://github.com/anoma/juvix/pull/1575) + ([lukaszcz](https://github.com/lukaszcz)) +- Fix symbol numbering bug + [#1574](https://github.com/anoma/juvix/pull/1574) + ([lukaszcz](https://github.com/lukaszcz)) +- 1569 rewrite the test for lambda lifting to use evaluation + [#1572](https://github.com/anoma/juvix/pull/1572) + ([janmasrovira](https://github.com/janmasrovira)) +- Remove lambda from reservedSymbols + [#1568](https://github.com/anoma/juvix/pull/1568) + ([lukaszcz](https://github.com/lukaszcz)) +- Keywords refactor [#1566](https://github.com/anoma/juvix/pull/1566) + ([janmasrovira](https://github.com/janmasrovira)) +- remove ≔ from the language and replace it by := + [#1563](https://github.com/anoma/juvix/pull/1563) + ([janmasrovira](https://github.com/janmasrovira)) +- JuvixReg [#1551](https://github.com/anoma/juvix/pull/1551) + ([lukaszcz](https://github.com/lukaszcz)) +- Remove duplicate function in concrete analysis + [#1550](https://github.com/anoma/juvix/pull/1550) + ([ii8](https://github.com/ii8)) +- Evaluator minor style refactor + [#1547](https://github.com/anoma/juvix/pull/1547) + ([janmasrovira](https://github.com/janmasrovira)) +- Properly handle top lambdas in the termination checker + [#1544](https://github.com/anoma/juvix/pull/1544) + ([janmasrovira](https://github.com/janmasrovira)) +- Mutual inference [#1543](https://github.com/anoma/juvix/pull/1543) + ([janmasrovira](https://github.com/janmasrovira)) +- Autocomplete ".jvc" input files for core {eval, read} commands + [#1542](https://github.com/anoma/juvix/pull/1542) + ([paulcadman](https://github.com/paulcadman)) +- Add –show-de-bruijn to `core eval` command + [#1540](https://github.com/anoma/juvix/pull/1540) + ([paulcadman](https://github.com/paulcadman)) +- Inductive types should depend on the types of their constructors + [#1537](https://github.com/anoma/juvix/pull/1537) + ([lukaszcz](https://github.com/lukaszcz)) +- Parser labels [#1535](https://github.com/anoma/juvix/pull/1535) + ([janmasrovira](https://github.com/janmasrovira)) +- JuvixAsm [#1432](https://github.com/anoma/juvix/pull/1432) + ([lukaszcz](https://github.com/lukaszcz)) + +## [v0.2.5](https://github.com/anoma/juvix/tree/v0.2.5) (2022-09-14) + +[Full Changelog](https://github.com/anoma/juvix/compare/v0.2.4...v0.2.5) + +**Fixed bugs:** + +- Properly type check patterns that need normalization + [#1472](https://github.com/anoma/juvix/pull/1472) + ([janmasrovira](https://github.com/janmasrovira)) +- Detect nested patterns as smaller in the termination checker + [#1524](https://github.com/anoma/juvix/pull/1524) +- Fix developBeta in Core/Extra.hs + [#1487](https://github.com/anoma/juvix/pull/1487) + ([lukaszcz](https://github.com/lukaszcz)) +- Core/Extra/Recursors/Collector bugfix + [#1510](https://github.com/anoma/juvix/pull/1510) + ([lukaszcz](https://github.com/lukaszcz)) + +**Merged pull requests:** + +- Replace -\> by := in lambda syntax + [#1533](https://github.com/anoma/juvix/pull/1533) + ([janmasrovira](https://github.com/janmasrovira)) +- 'Match' with complex patterns in Core + [#1530](https://github.com/anoma/juvix/pull/1530) + ([lukaszcz](https://github.com/lukaszcz)) +- Refactor CLI [#1527](https://github.com/anoma/juvix/pull/1527) + ([janmasrovira](https://github.com/janmasrovira)) +- Add CanonicalProjection + [#1526](https://github.com/anoma/juvix/pull/1526) + ([janmasrovira](https://github.com/janmasrovira)) +- Make comma a delimiter + [#1525](https://github.com/anoma/juvix/pull/1525) + ([lukaszcz](https://github.com/lukaszcz)) +- Detect nested patterns as smaller in the termination checker + [#1524](https://github.com/anoma/juvix/pull/1524) + ([janmasrovira](https://github.com/janmasrovira)) +- Disallow tab characters as spaces + [#1523](https://github.com/anoma/juvix/pull/1523) + ([janmasrovira](https://github.com/janmasrovira)) +- Refactor `destruct` in Core/Extra/Base + [#1522](https://github.com/anoma/juvix/pull/1522) + ([lukaszcz](https://github.com/lukaszcz)) +- JuvixCore primitive types + [#1521](https://github.com/anoma/juvix/pull/1521) + ([lukaszcz](https://github.com/lukaszcz)) +- Enable autocompletion for the –theme flag + [#1519](https://github.com/anoma/juvix/pull/1519) + ([janmasrovira](https://github.com/janmasrovira)) +- Stripped version of Core Node datatype + [#1518](https://github.com/anoma/juvix/pull/1518) + ([lukaszcz](https://github.com/lukaszcz)) +- Add `internal core read` command + [#1517](https://github.com/anoma/juvix/pull/1517) + ([janmasrovira](https://github.com/janmasrovira)) +- Implement some instances for BinderList + [#1515](https://github.com/anoma/juvix/pull/1515) + ([janmasrovira](https://github.com/janmasrovira)) +- Back recursor types with type families + [#1514](https://github.com/anoma/juvix/pull/1514) + ([janmasrovira](https://github.com/janmasrovira)) +- Eager evaluation of Constr arguments + [#1513](https://github.com/anoma/juvix/pull/1513) + ([lukaszcz](https://github.com/lukaszcz)) +- Dynamic type in Core + [#1508](https://github.com/anoma/juvix/pull/1508) + ([lukaszcz](https://github.com/lukaszcz)) +- LetRec in Core [#1507](https://github.com/anoma/juvix/pull/1507) + ([lukaszcz](https://github.com/lukaszcz)) +- Add Haddock and Agda licenses + [#1506](https://github.com/anoma/juvix/pull/1506) + ([janmasrovira](https://github.com/janmasrovira)) +- Fix docs webapp examples CI build + [#1505](https://github.com/anoma/juvix/pull/1505) + ([paulcadman](https://github.com/paulcadman)) +- Add CLI usage examples doc and integrate with README + [#1504](https://github.com/anoma/juvix/pull/1504) + ([paulcadman](https://github.com/paulcadman)) +- Refactor BinderInfo + [#1503](https://github.com/anoma/juvix/pull/1503) + ([lukaszcz](https://github.com/lukaszcz)) +- Make `juvix compile` default to native target + [#1502](https://github.com/anoma/juvix/pull/1502) + ([paulcadman](https://github.com/paulcadman)) +- Refactor Node datatype + [#1501](https://github.com/anoma/juvix/pull/1501) + ([lukaszcz](https://github.com/lukaszcz)) +- Clean up import list in Pipeline + [#1499](https://github.com/anoma/juvix/pull/1499) + ([jonaprieto](https://github.com/jonaprieto)) +- Remove mono [#1497](https://github.com/anoma/juvix/pull/1497) + ([jonaprieto](https://github.com/jonaprieto)) +- Remove Haskell support + [#1496](https://github.com/anoma/juvix/pull/1496) + ([jonaprieto](https://github.com/jonaprieto)) +- Implement lambda lifting + [#1494](https://github.com/anoma/juvix/pull/1494) + ([janmasrovira](https://github.com/janmasrovira)) +- Document Emacs installation and the 'exec-path' problem + [#1493](https://github.com/anoma/juvix/pull/1493) + ([lukaszcz](https://github.com/lukaszcz)) +- Add –allow-different-user to workflow stack command + [#1492](https://github.com/anoma/juvix/pull/1492) + ([paulcadman](https://github.com/paulcadman)) +- Stack with github actions permissions workaround + [#1490](https://github.com/anoma/juvix/pull/1490) + ([paulcadman](https://github.com/paulcadman)) +- Restructure recursors and add some lens interfaces + [#1489](https://github.com/anoma/juvix/pull/1489) + ([janmasrovira](https://github.com/janmasrovira)) +- Add a github action to build a static linux binary + [#1488](https://github.com/anoma/juvix/pull/1488) + ([paulcadman](https://github.com/paulcadman)) +- Fix developBeta in Core/Extra.hs + [#1487](https://github.com/anoma/juvix/pull/1487) + ([lukaszcz](https://github.com/lukaszcz)) +- Add an option to show name ids in errors + [#1486](https://github.com/anoma/juvix/pull/1486) + ([lukaszcz](https://github.com/lukaszcz)) + +## [v0.2.4](https://github.com/anoma/juvix/tree/v0.2.4) (2022-08-19) + +[Full Changelog](https://github.com/anoma/juvix/compare/v0.2.3...v0.2.4) + +(Special version for Heliax's retreat in Italy) + +**Implemented enhancements:** + +- Add –stdin flag [#1459](https://github.com/anoma/juvix/pull/1459) + ([janmasrovira](https://github.com/janmasrovira)) + +**Fixed bugs:** + +- Fix typechecker [#1458](https://github.com/anoma/juvix/pull/1458) + ([janmasrovira](https://github.com/janmasrovira)) + +**Merged pull requests:** + +- use –stdin in flycheck mode + [#1460](https://github.com/anoma/juvix/pull/1460) + ([janmasrovira](https://github.com/janmasrovira)) +- Add a native compile target for demos + [#1457](https://github.com/anoma/juvix/pull/1457) + ([paulcadman](https://github.com/paulcadman)) +- Small changes for the presentation + [#1456](https://github.com/anoma/juvix/pull/1456) + ([jonaprieto](https://github.com/jonaprieto)) +- Fixes TicTacToe Web example + [#1454](https://github.com/anoma/juvix/pull/1454) + ([paulcadman](https://github.com/paulcadman)) +- Upgrade to ghc-9.2.4 + [#1451](https://github.com/anoma/juvix/pull/1451) + ([janmasrovira](https://github.com/janmasrovira)) + +## [v0.2.3](https://github.com/anoma/juvix/tree/v0.2.3) (2022-08-15) + +[Full Changelog](https://github.com/anoma/juvix/compare/v0.2.2...v0.2.3) + +**Implemented enhancements:** + +- add `name` and `version` to `juvix.yaml` + [#1422](https://github.com/anoma/juvix/pull/1422) + ([janmasrovira](https://github.com/janmasrovira)) + +**Fixed bugs:** + +- Properly handle paragraphs in judoc + [#1447](https://github.com/anoma/juvix/pull/1447) + ([janmasrovira](https://github.com/janmasrovira)) + +**Merged pull requests:** + +- Give a proper type to literal natural numbers + [#1453](https://github.com/anoma/juvix/pull/1453) + ([janmasrovira](https://github.com/janmasrovira)) +- Add the option to output json in the `juvix internal highlight` + command [#1450](https://github.com/anoma/juvix/pull/1450) + ([janmasrovira](https://github.com/janmasrovira)) for supporting the + new Juvix Mode for Visual Studio Code + ([jonaprieto](https://github.com/anoma/vscode-juvix)) +- Allow \_ in Wasm exported names to support Anoma signature + [#1449](https://github.com/anoma/juvix/pull/1449) + ([paulcadman](https://github.com/paulcadman)) +- Add Towers of Hanoi and Pascal triangle examples + [#1446](https://github.com/anoma/juvix/pull/1446) + ([paulcadman](https://github.com/paulcadman)) +- Add `juvix init` command + [#1445](https://github.com/anoma/juvix/pull/1445) + ([janmasrovira](https://github.com/janmasrovira)) +- Refactor pretty to reduce duplication + [#1443](https://github.com/anoma/juvix/pull/1443) + ([janmasrovira](https://github.com/janmasrovira)) +- Add initial support for examples in Html documentation + [#1442](https://github.com/anoma/juvix/pull/1442) + ([janmasrovira](https://github.com/janmasrovira)) +- Add revisions to README + [#1440](https://github.com/anoma/juvix/pull/1440) + ([jonaprieto](https://github.com/jonaprieto)) +- CI: Run build on push to main + [#1437](https://github.com/anoma/juvix/pull/1437) + ([paulcadman](https://github.com/paulcadman)) +- Add doctor subcommand + [#1436](https://github.com/anoma/juvix/pull/1436) + ([paulcadman](https://github.com/paulcadman)) +- CI checkout repo before cache and use recommended cache strategy + [#1435](https://github.com/anoma/juvix/pull/1435) + ([paulcadman](https://github.com/paulcadman)) +- Various documentation adjustments + [#1434](https://github.com/anoma/juvix/pull/1434) + ([paulcadman](https://github.com/paulcadman)) +- Setup Clang before building docs in CI + [#1433](https://github.com/anoma/juvix/pull/1433) + ([paulcadman](https://github.com/paulcadman)) +- Major revisions to Makefile + [#1431](https://github.com/anoma/juvix/pull/1431) + ([jonaprieto](https://github.com/jonaprieto)) +- Do not add `-src` suffix to links in HTML when running `juvix html` + [#1429](https://github.com/anoma/juvix/pull/1429) + ([paulcadman](https://github.com/paulcadman)) +- Add a Web version of TicTacToe + [#1427](https://github.com/anoma/juvix/pull/1427) + ([paulcadman](https://github.com/paulcadman)) +- WASM import all non-compile axioms with alphanum names in entrypoint + [#1426](https://github.com/anoma/juvix/pull/1426) + ([paulcadman](https://github.com/paulcadman)) +- Export all functions with alpha numeric names from entrypoint module + [#1425](https://github.com/anoma/juvix/pull/1425) + ([paulcadman](https://github.com/paulcadman)) +- Refactor [#1420](https://github.com/anoma/juvix/pull/1420) + ([jonaprieto](https://github.com/jonaprieto)) +- Permit axiom without a compile block + [#1418](https://github.com/anoma/juvix/pull/1418) + ([paulcadman](https://github.com/paulcadman)) +- Implement an html documentation generator similar to haddock (#1413) + [#1416](https://github.com/anoma/juvix/pull/1416) + ([janmasrovira](https://github.com/janmasrovira)) +- Fix version shell test for 0.2.2 + [#1415](https://github.com/anoma/juvix/pull/1415) + ([paulcadman](https://github.com/paulcadman)) +- Remove Int from stdlib and update SimpleFungibleToken example + [#1414](https://github.com/anoma/juvix/pull/1414) + ([paulcadman](https://github.com/paulcadman)) + +## [v0.2.2](https://github.com/anoma/juvix/tree/v0.2.2) (2022-07-25) + +[Full Changelog](https://github.com/anoma/juvix/compare/v0.2.1...v0.2.2) + +**Implemented enhancements:** + +- Compute name dependency graph and filter unreachable definitions + [#1408](https://github.com/anoma/juvix/pull/1408) + ([lukaszcz](https://github.com/lukaszcz)) +- Support type aliases + [#1404](https://github.com/anoma/juvix/pull/1404) + ([janmasrovira](https://github.com/janmasrovira)) +- Add debugging custom function to Prelude + [#1401](https://github.com/anoma/juvix/pull/1401) + ([jonaprieto](https://github.com/jonaprieto)) +- Add positivity check for data types + [#1393](https://github.com/anoma/juvix/pull/1393) + ([jonaprieto](https://github.com/jonaprieto)) +- Keep qualified names + [#1392](https://github.com/anoma/juvix/pull/1392) + ([janmasrovira](https://github.com/janmasrovira)) +- Direct translation from MicroJuvix to MiniC + [#1386](https://github.com/anoma/juvix/pull/1386) + ([lukaszcz](https://github.com/lukaszcz)) +- Widens the accepted symbol list + [#1385](https://github.com/anoma/juvix/pull/1385) + ([mariari](https://github.com/mariari)) +- Check all the type parameter names are different when declaring an + inductive type [#1377](https://github.com/anoma/juvix/pull/1377) + ([jonaprieto](https://github.com/jonaprieto)) + +**Fixed bugs:** + +- Curly braces are allowed nested in patterns + [#1380](https://github.com/anoma/juvix/pull/1380) + ([janmasrovira](https://github.com/janmasrovira)) + +**Merged pull requests:** + +- Add `Fail` effect (#1409) + [#1411](https://github.com/anoma/juvix/pull/1411) + ([janmasrovira](https://github.com/janmasrovira)) +- Refactor of typechecking and other checking processes + [#1410](https://github.com/anoma/juvix/pull/1410) + ([jonaprieto](https://github.com/jonaprieto)) +- Use bold for code in scoper error messages + [#1403](https://github.com/anoma/juvix/pull/1403) + ([janmasrovira](https://github.com/janmasrovira)) +- Replace ppSimple by text + [#1402](https://github.com/anoma/juvix/pull/1402) + ([jonaprieto](https://github.com/jonaprieto)) +- Implement some error messages (#1396) + [#1400](https://github.com/anoma/juvix/pull/1400) + ([lukaszcz](https://github.com/lukaszcz)) +- Refactor childs of pattern parentheses and braces + [#1398](https://github.com/anoma/juvix/pull/1398) + ([janmasrovira](https://github.com/janmasrovira)) +- Update Juvix standard-library + [#1389](https://github.com/anoma/juvix/pull/1389) + ([jonaprieto](https://github.com/jonaprieto)) +- Fix documentation generation + [#1387](https://github.com/anoma/juvix/pull/1387) + ([jonaprieto](https://github.com/jonaprieto)) +- Adds Collatz sequence generator example + [#1384](https://github.com/anoma/juvix/pull/1384) + ([paulcadman](https://github.com/paulcadman)) +- html-examples [#1381](https://github.com/anoma/juvix/pull/1381) + ([jonaprieto](https://github.com/jonaprieto)) +- Refine hole in type signature to function type + [#1379](https://github.com/anoma/juvix/pull/1379) + ([janmasrovira](https://github.com/janmasrovira)) +- Type checking fails when the type of a pattern is not given by the + signature [#1378](https://github.com/anoma/juvix/pull/1378) + ([janmasrovira](https://github.com/janmasrovira)) +- Set cname for gh-pages action + [#1376](https://github.com/anoma/juvix/pull/1376) + ([paulcadman](https://github.com/paulcadman)) +- Add fibonacci sequence example program + [#1375](https://github.com/anoma/juvix/pull/1375) + ([paulcadman](https://github.com/paulcadman)) +- Fix Changelog links and minors + [#1371](https://github.com/anoma/juvix/pull/1371) + ([jonaprieto](https://github.com/jonaprieto)) +- Add Version number to the emacs mode + [#1320](https://github.com/anoma/juvix/pull/1320) + ([mariari](https://github.com/mariari)) + +## New name: Juvix + +Since version 0.2.2, the project has been renamed from "Mini Juvix" to +"Juvix". The new name reflects the fact that the project is no longer +just a compiler for a subset of Juvix, but a full implementation of the +language. Affected by this change are: + +- Github repository moved from the Heliax organization to the Anoma + organization. "anoma/juvix" is the new repository name. +- All references to "Mini Juvix" have been replaced with "Juvix". + Unfortunetly, + +due to the move, the old links to the Mini Juvix repository are broken +and will not be fixed. + +## v0.2.1 (2022-07-12) + +**Implemented enhancements:** + +- Specialize commands of/for internal use MiniJuvix-#270 + ([jonaprieto](https://github.com/jonaprieto)) +- Improve handling of location information for different objs + MiniJuvix-#263 ([jonaprieto](https://github.com/jonaprieto)) +- Add issues and PR templates MiniJuvix-#261 + ([jonaprieto](https://github.com/jonaprieto)) +- Throw error when reading a file that conflicts with embedded stdlib + MiniJuvix-#243 ([paulcadman](https://github.com/paulcadman)) +- Embed standard library in the minijuvix binary MiniJuvix-#210 + ([paulcadman](https://github.com/paulcadman)) + +**Fixed bugs:** + +- Fixed a bug with the path to walloc.c MiniJuvix-#237 + ([lukaszcz](https://github.com/lukaszcz)) +- Perform ScopedToAbstract exactly once for each module MiniJuvix-#223 + ([paulcadman](https://github.com/paulcadman)) + +**Merged pull requests:** + +- Label renaming MiniJuvix-#275 + ([jonaprieto](https://github.com/jonaprieto)) +- Update link to discord MiniJuvix-#264 + ([Romainua](https://github.com/Romainua)) +- Include `open import` statements when generating HTML MiniJuvix-#260 + ([paulcadman](https://github.com/paulcadman)) +- Renaming MiniJuvix to Juvix MiniJuvix-#259 + ([jonaprieto](https://github.com/jonaprieto)) +- Updates tests to use the updated standard library MiniJuvix-#253 + ([paulcadman](https://github.com/paulcadman)) +- Enforce C99 standard in the generated C files MiniJuvix-#252 + ([lukaszcz](https://github.com/lukaszcz)) +- Restore mascot images to the minijuvix book MiniJuvix-#250 + ([paulcadman](https://github.com/paulcadman)) +- Allow jumping to another module in emacs MiniJuvix-#249 + ([janmasrovira](https://github.com/janmasrovira)) +- Restore Juvix mascot image to README MiniJuvix-#248 + ([paulcadman](https://github.com/paulcadman)) +- Add emacs option `minijuvix-disable-embedded-stdlib` MiniJuvix-#247 + ([paulcadman](https://github.com/paulcadman)) +- Deprecate GHC backend MiniJuvix-#244 + ([lukaszcz](https://github.com/lukaszcz)) +- Removed 'eval' and 'print' keywords (#214) MiniJuvix-#242 + ([lukaszcz](https://github.com/lukaszcz)) +- Add option to disable minijuvix input method MiniJuvix-#239 + ([janmasrovira](https://github.com/janmasrovira)) +- Remove the 'match' keyword MiniJuvix-#238 + ([lukaszcz](https://github.com/lukaszcz)) +- Removed tests/positive/HelloWorld.mjuvix and specified clang version + in the documentation MiniJuvix-#236 + ([lukaszcz](https://github.com/lukaszcz)) +- Filter symbol entries properly in the scoper MiniJuvix-#234 + ([janmasrovira](https://github.com/janmasrovira)) +- Use the ModulesCache for `open` statements in ScopedToAbstract pass + MiniJuvix-#224 ([paulcadman](https://github.com/paulcadman)) +- README: Include `--recursive` in git clone command to fetch stdlib + MiniJuvix-#211 ([paulcadman](https://github.com/paulcadman)) +- Update project description v0.2.0 MiniJuvix-#209 + ([jonaprieto](https://github.com/jonaprieto)) +- Unify AST representation of types and expressions in MicroJuvix + MiniJuvix-#188 ([janmasrovira](https://github.com/janmasrovira)) + +## v0.2.0 (2022-06-28) + +**Implemented enhancements:** + +- Support built in types MiniJuvix-#192 + ([janmasrovira](https://github.com/janmasrovira)) +- Support partial application and closure passing in C backend + MiniJuvix-#190 ([paulcadman](https://github.com/paulcadman)) +- Allow `open import` statements MiniJuvix-#175 + ([janmasrovira](https://github.com/janmasrovira)) +- Remove TypeAny and adapt typechecking for literals MiniJuvix-#173 + ([janmasrovira](https://github.com/janmasrovira)) +- Allow holes to be refined into function types MiniJuvix-#165 + ([janmasrovira](https://github.com/janmasrovira)) +- Support implicit arguments MiniJuvix-#144 + ([janmasrovira](https://github.com/janmasrovira)) +- Add support for holes in type signatures MiniJuvix-#141 + ([janmasrovira](https://github.com/janmasrovira)) +- Support function closures with no environment in minic + MiniJuvix-#137 ([paulcadman](https://github.com/paulcadman)) +- Add holes for expressions in function clauses and inference support + MiniJuvix-#136 ([janmasrovira](https://github.com/janmasrovira)) +- Add "-Oz" optimization flag to clang args MiniJuvix-#133 + ([paulcadman](https://github.com/paulcadman)) +- Add version and help option and root command to the CLI + MiniJuvix-#131 ([jonaprieto](https://github.com/jonaprieto)) + +**Fixed bugs:** + +- Fix: Ignore implicit patterns and arguments in termination checking + MiniJuvix-#172 ([janmasrovira](https://github.com/janmasrovira)) +- Fix: pretty printing for terminating keyword MiniJuvix-#145 + ([jonaprieto](https://github.com/jonaprieto)) + +**Merged pull requests:** + +- Fix: proper error handling for typechecker errors MiniJuvix-#189 + ([jonaprieto](https://github.com/jonaprieto)) +- Add juvix version info and date to HTML output MiniJuvix-#186 + ([jonaprieto](https://github.com/jonaprieto)) +- Fix: Add check for constructor return types MiniJuvix-#182 + ([jonaprieto](https://github.com/jonaprieto)) +- Use Abstract name in Abstract syntax and Micro/MonoJuvix + MiniJuvix-#181 ([janmasrovira](https://github.com/janmasrovira)) +- Add an option to specify the path where to put the HTML output + MiniJuvix-#179 ([jonaprieto](https://github.com/jonaprieto)) +- Upgrade to ghc-9.2.3 MiniJuvix-#178 + ([janmasrovira](https://github.com/janmasrovira)) +- Replace dead link in README with a link to the Juvix book + MiniJuvix-#177 ([paulcadman](https://github.com/paulcadman)) +- Embed HTML assets in the juvix binary MiniJuvix-#176 + ([paulcadman](https://github.com/paulcadman)) +- Fix: identifiers with a keyword prefix cannot be parsed + MiniJuvix-#171 ([janmasrovira](https://github.com/janmasrovira)) +- Improve filepath equality MiniJuvix-#170 + ([janmasrovira](https://github.com/janmasrovira)) +- Update validity predicate milestone example to 0.2 syntax + MiniJuvix-#167 ([paulcadman](https://github.com/paulcadman)) +- Fix links in documentation and update to new syntax MiniJuvix-#163 + ([paulcadman](https://github.com/paulcadman)) +- Update stdlib to work with version 0.2 MiniJuvix-#160 + ([janmasrovira](https://github.com/janmasrovira)) +- Update README usage example to use the compile command + MiniJuvix-#158 ([paulcadman](https://github.com/paulcadman)) +- Remove dead code related to the pipeline MiniJuvix-#156 + ([janmasrovira](https://github.com/janmasrovira)) +- Add negative test for AppLeftImplicit MiniJuvix-#154 + ([janmasrovira](https://github.com/janmasrovira)) +- Add positive test designed for implicit arguments MiniJuvix-#153 + ([janmasrovira](https://github.com/janmasrovira)) +- Remove ExpressionTyped from MicroJuvix MiniJuvix-#143 + ([janmasrovira](https://github.com/janmasrovira)) +- Revision for package.yaml and minor deletions MiniJuvix-#135 + ([jonaprieto](https://github.com/jonaprieto)) + +## v0.1.4 (2022-05-30) + +**Merged pull requests:** + +- Generic Errors and refactoring MiniJuvix-#123 + ([jonaprieto](https://github.com/jonaprieto)) +- Only generates docs if the pull request merges MiniJuvix-#121 + ([jonaprieto](https://github.com/jonaprieto)) +- Add initial docs generation website MiniJuvix-#119 + ([jonaprieto](https://github.com/jonaprieto)) +- Fix internal link in README MiniJuvix-#116 + ([paulcadman](https://github.com/paulcadman)) +- Add minic-runtime for linking without libc MiniJuvix-#113 + ([paulcadman](https://github.com/paulcadman)) +- Add termination checking to the pipeline MiniJuvix-#111 + ([jonaprieto](https://github.com/jonaprieto)) +- Support uncurried higher order functions MiniJuvix-#110 + ([paulcadman](https://github.com/paulcadman)) +- Improve error generation and handling MiniJuvix-#108 + ([janmasrovira](https://github.com/janmasrovira)) +- Add MiniC tests with clang+wasi-sdk MiniJuvix-#105 + ([paulcadman](https://github.com/paulcadman)) +- Add usage example and move developer docs MiniJuvix-#96 + ([paulcadman](https://github.com/paulcadman)) +- Refactor warning related stuff MiniJuvix-#91 + ([janmasrovira](https://github.com/janmasrovira)) +- Remove Agda backend MiniJuvix-#86 + ([paulcadman](https://github.com/paulcadman)) + +**Implemented enhancements:** + +- Add `compile` subcommand to generate binaries MiniJuvix-#128 +- Add intervals to flycheck errors MiniJuvix-#124 +- Improve error handling in juvix-mode MiniJuvix-#107 +- Support multiple modules in compilation MiniJuvix-#93 +- Add compile command to CLI MiniJuvix-#130 + ([paulcadman](https://github.com/paulcadman)) +- Use Interval in GenericErrors MiniJuvix-#125 + ([janmasrovira](https://github.com/janmasrovira)) +- Remove dev in the CI and other tweaks MiniJuvix-#118 + ([jonaprieto](https://github.com/jonaprieto)) +- Highlight comments correctly MiniJuvix-#106 + ([janmasrovira](https://github.com/janmasrovira)) +- Support multiple modules in compilation MiniJuvix-#100 + ([janmasrovira](https://github.com/janmasrovira)) +- New target syntax and modular VP examples MiniJuvix-#92 + ([jonaprieto](https://github.com/jonaprieto)) + +**Fixed bugs:** + +- Missing error messages when using throw/error MiniJuvix-#117 +- Fix highlight of comments MiniJuvix-#104 +- Fix juvix-mode coloring for projects with multiple modules + MiniJuvix-#101 +- Fix `highlight` command for modules with import statements + MiniJuvix-#102 ([janmasrovira](https://github.com/janmasrovira)) + +**Closed issues:** + +- Deprecate the class JuvixError MiniJuvix-#115 +- Add ToGenericError instance for the infix parsing errors + MiniJuvix-#114 +- Compile to WASM without linking libc MiniJuvix-#112 +- Add the termination checker to the pipeline MiniJuvix-#109 +- Use clang + wasi-sdk instead of emcc to compile to WASM + MiniJuvix-#103 +- Move developer tooling docs out of README MiniJuvix-#95 +- Add pre-commit checks to CI checks MiniJuvix-#94 +- Support higher order functions in C backend MiniJuvix-#90 +- Remove dev from the list of branches in the CI MiniJuvix-#89 +- Refactor warning related stuff MiniJuvix-#87 +- The Juvix website MiniJuvix-#51 + +## v0.1.3 (2022-05-05) + +**Closed issues:** + +- Monomorphisation naming inconsistency MiniJuvix-#84 +- Remove BackendAgda MiniJuvix-#83 +- Change terminating keyword behavior MiniJuvix-#81 +- MonoJuvix `ExpressionTyped` is never used MiniJuvix-#79 +- Bump stackage nightly and delete `allow-newer: true` from + `stack.yaml` MiniJuvix-#75 +- Generate automatically CHANGELOG and Github Release Notes + MiniJuvix-#73 +- Make flag –show-name-ids global MiniJuvix-#61 +- Add C code generation backend MiniJuvix-#60 +- Add polymorphism MiniJuvix-#59 +- Add the compile keyword to the frontend syntax (support up to + Scoping) MiniJuvix-#58 +- Error with undefined or underscores MiniJuvix-#54 +- Add support for other GHC and Stack stable version MiniJuvix-#52 +- Autodetect output ANSI support when prettyprinting MiniJuvix-#38 +- Terminating for type signatures MiniJuvix-#11 + +**Merged pull requests:** + +- Remove agda backend MiniJuvix-#86 + ([paulcadman](https://github.com/paulcadman)) +- 84 monomorphisation naming inconsistency MiniJuvix-#85 + ([janmasrovira](https://github.com/janmasrovira)) +- Change terminating keyword behavior MiniJuvix-#82 + ([jonaprieto](https://github.com/jonaprieto)) +- Remove unused constructor ExpressionTyped in Monojuvix MiniJuvix-#80 + ([janmasrovira](https://github.com/janmasrovira)) +- Stricter stack builds and pedantic mode for CI MiniJuvix-#78 + ([jonaprieto](https://github.com/jonaprieto)) +- Bump stackage version and remove allow-newer MiniJuvix-#76 + ([janmasrovira](https://github.com/janmasrovira)) +- Add automatically updates/issues/merged PRs to the changelog + MiniJuvix-#74 ([jonaprieto](https://github.com/jonaprieto)) +- Add terminating keyword MiniJuvix-#71 + ([jonaprieto](https://github.com/jonaprieto)) +- Monomorphization MiniJuvix-#70 + ([janmasrovira](https://github.com/janmasrovira)) +- Remove StatementCompile in AST after scoping MiniJuvix-#69 + ([paulcadman](https://github.com/paulcadman)) +- Add C code generation backend MiniJuvix-#68 + ([paulcadman](https://github.com/paulcadman)) +- Check if stderr supports ANSI and print accordingly MiniJuvix-#67 + ([janmasrovira](https://github.com/janmasrovira)) +- Add support for compile (by Jonathan) MiniJuvix-#66 + ([paulcadman](https://github.com/paulcadman)) +- Add NameIdGen effect to the pipeline MiniJuvix-#64 + ([janmasrovira](https://github.com/janmasrovira)) +- Make the `--show-name-ids` flag global MiniJuvix-#63 + ([janmasrovira](https://github.com/janmasrovira)) +- Implement type checker with polymorphism MiniJuvix-#62 + ([janmasrovira](https://github.com/janmasrovira)) + +## v0.1.2 (2022-04-11) + +**Closed issues:** + +- Add en emacs mode with support for scoped highlighting MiniJuvix-#25 +- Add support for project root detection through a juvix.yaml file + MiniJuvix-#24 +- Add CLI cmd to generate juvix autocompletion files for fish and zsh + MiniJuvix-#23 +- Add pretty and typecheck subcommands to the microjuvix CLI + MiniJuvix-#21 +- Translate identifiers from MicroJuvix to MiniHaskell (valid Haskell) + MiniJuvix-#19 +- Implement the MiniHaskell to Haskell translation (prettyprinter) + MiniJuvix-#18 +- Implementation of a typechecker for MicroJuvix MiniJuvix-#16 +- Add references to the Abstract AST to update compilation to + MiniHaskell MiniJuvix-#12 +- Order in the house MiniJuvix-#10 + +**Merged pull requests:** + +- The Juvix project now follows the same goals as the original Juvix + project. MiniJuvix-#7 ([jonaprieto](https://github.com/jonaprieto)) +- Dev→main MiniJuvix-#6 ([jonaprieto](https://github.com/jonaprieto)) +- Big update including termination checking MiniJuvix-#5 + ([janmasrovira](https://github.com/janmasrovira)) +- Parser and scoper MiniJuvix-#3 + ([jonaprieto](https://github.com/jonaprieto)) +- Upgrade to ghc9 and use hpack MiniJuvix-#2 + ([janmasrovira](https://github.com/janmasrovira)) +- Merge MiniJuvix-#1 ([jonaprieto](https://github.com/jonaprieto)) + +## v0.1.1 (2022-03-25) + +- Add support in the parser/scoper for Axiom backends +- Add support for `foreign` keyword +- Add flag `--no-colors` for the scope command +- Upgrade to GHC 9.2.2 +- Improve resolution of local symbols in the scoper +- Several new tests related to ambiguous symbols +- Add `--version` flag +- Add InfoTableBuilder effect for the scoper + +**Closed issues:** + +- Add diff output to the test suite MiniJuvix-#9 +- Improve scoper ambiguity error messages MiniJuvix-#8 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..727803a1a --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,64 @@ +# Contributing to Juvix + +Thank you for considering contributing to Juvix! We welcome all contributions, big or small, +of any kind. We appreciate any help/feedback we can get. + +## Getting Started + +Make sure you have followed the [installation instructions][installation] and have a working Juvix installation. You can also use the web-based development environment ready to the Juvix development, [Juvix Github Codespace][juvix-codespace] + +1. Fork the repository. +2. Clone your forked repository to your local machine. +3. Install [Stack][stack] if you + haven't already. +4. Build the project by running `stack build`. To build the project with + optimizations, run `stack build --fast`. To install the binaries to your + local `~/.local/bin`, run `stack install`. +5. Run the tests by running `stack test`. +6. Make sure to install the [pre-commit][pre-commit] binary, so you + can run the pre-commit hooks by running `make precommit` in the root + directory of the project. All the Pull Requests will be checked by the + pre-commit hooks. + +## Making Changes + +1. Create a new branch for your changes: `git checkout -b my-branch-name`. In case you are working on an issue, please name your branch after the issue number, e.g. `issue-123`. +2. Make your changes and commit them with a descriptive message. +3. Push your changes to your forked repository: `git push origin my-branch-name`. +4. Submit a pull request to the main repository with a concise description of your changes. +5. Make sure that your pull request passes all the tests and pre-commit hooks. + +## Haskell Code Style + +We value readability and maintainability over saving lines of code. The best +source of truth for the Juvix code style is the existing codebase. We strongly +encourage you to look at the existing code and follow the same style. Open an +issue if you have any questions, or better yet, join our +[Discord][discord] and ask there! + +Some basic guidelines when writing code: + +- Use clear and descriptive names for variables, functions, and types. +- Keep functions short and focused on a single task. Separate functions when + they start to get too long. +- Use comments to explain complex or non-obvious code. +- Run `make format` to format your code with `ormolu`. + +## Testing + +Please include tests for any new functionality or bug fixes. The tests are +located in the `test` directory, the tests are written in Haskell and use the +tasty framework. To run the tests, run `stack test`. If you are changing the +CLI, please also update the smoke tests in the `tests/smoke` directory. + +## Code Review + +All pull requests will be reviewed by at least one member of the development team. Feedback may be provided on the code itself, as well as on the tests and documentation. + +Thank you for contributing to Juvix! + +[installation]: https://docs.juvix.org/howto/installing.html +[juvix-codespace]: https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=102404734&machine=standardLinux32gb&location=WestEurope +[stack]: https://docs.haskellstack.org/en/stable/README/ +[pre-commit]: https://pre-commit.com/ +[discord]: https://discord.gg/PfaaFVErHt diff --git a/LICENSE b/LICENSE.md similarity index 99% rename from LICENSE rename to LICENSE.md index f288702d2..8bf357ef0 100644 --- a/LICENSE +++ b/LICENSE.md @@ -1,3 +1,4 @@ +``` GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -672,3 +673,4 @@ may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . +``` diff --git a/Makefile b/Makefile index 1a040b181..f1d1c7bb4 100644 --- a/Makefile +++ b/Makefile @@ -2,11 +2,6 @@ PWD=$(CURDIR) PREFIX="$(PWD)/.stack-work/prefix" UNAME := $(shell uname) -IMAGES = $(shell find assets/images -type f) - -ORGFILES = $(shell find docs/org -type f -name '*.org') -MDFILES:=$(patsubst docs/org/%,docs/md/%,$(ORGFILES:.org=.md)) - EXAMPLEMILESTONE=examples/milestone EXAMPLEHTMLOUTPUT=_docs/examples/html EXAMPLES= Collatz/Collatz.juvix \ @@ -21,9 +16,10 @@ DEMO_EXAMPLE=examples/demo/Demo.juvix MAKEAUXFLAGS?=-s MAKE=make ${MAKEAUXFLAGS} - -ORGTOMDPRG ?=pandoc -ORGOPTS=--from org --to markdown_strict -s -o $@ +METAFILES:=README.md \ + CHANGELOG.md \ + CONTRIBUTING.md \ + LICENSE.md ifeq ($(UNAME), Darwin) THREADS := $(shell sysctl -n hw.logicalcpu) @@ -33,16 +29,10 @@ else THREADS := $(shell echo %NUMBER_OF_PROCESSORS%) endif -images: - echo $(IMAGES) - -all: install - clean: clean-runtime @stack clean --full @rm -rf .hie @rm -rf book - @rm -rf docs/md .PHONY: clean-hard clean-hard: clean @@ -81,39 +71,20 @@ demo-example: # -- MDBook -docs/md/README.md : README.org - @mkdir -p docs/md - @${ORGTOMDPRG} README.org ${ORGOPTS} - -docs/md/changelog.md : changelog.org - @mkdir -p docs/md - @${ORGTOMDPRG} changelog.org ${ORGOPTS} - -docs/md/%.md : docs/org/%.org - @echo "Processing ... $@" - @mkdir -p $(dir $@) - ${ORGTOMDPRG} $? ${ORGOPTS} - -.PHONY: markdown-files -markdown-files: docs/md/README.md docs/md/changelog.md $(MDFILES) - -.PHONY: markdown-docs -markdown-docs: cargo-dependencies markdown-files - @echo "copying assets ..." - @mkdir -p docs/md/assets/images - @cp -v $(IMAGES) docs/md/assets/images/ +.PHONY: docs +docs: + @cp $(METAFILES) docs/ @mdbook build .PHONY: serve-docs -serve-docs: markdown-files +serve-docs: docs @mdbook serve --open - cargo-dependencies: @cargo install mdbook \ - mdbook-katex \ - mdbook-linkcheck \ - mdbook-toc + mdbook-katex \ + mdbook-linkcheck \ + mdbook-pagetoc # -- Codebase Documentation @@ -130,8 +101,8 @@ ORMOLUFILES = $(shell git ls-files '*.hs' '*.hs-boot' | grep -v '^contrib/') ORMOLUFLAGS?=--no-cabal ORMOLUMODE?=inplace -.PHONY: format -format: clang-format +.PHONY: ormolu +ormolu: @${ORMOLU} ${ORMOLUFLAGS} \ --ghc-opt -XStandaloneDeriving \ --ghc-opt -XUnicodeSyntax \ @@ -142,6 +113,11 @@ format: clang-format --mode ${ORMOLUMODE} \ $(ORMOLUFILES) +.PHONY: format +format: + @${MAKE} clang-format + @${MAKE} ormolu + .PHONY: clang-format clang-format: @cd runtime && ${MAKE} format @@ -149,8 +125,6 @@ clang-format: TOFORMATJUVIXFILES = ./examples TOFORMAT = $(shell find ${TOFORMATJUVIXFILES} -name "*.juvix" -print) -.PHONY: $(TOFORMAT) -juvix-format: $(TOFORMAT) $(TOFORMAT): %: @echo "Formatting $@" @juvix dev scope $@ --with-comments > $@.tmp @@ -158,10 +132,14 @@ $(TOFORMAT): %: @echo "Typechecking formatted $@" @juvix typecheck $@ --only-errors +.PHONY: $(TOFORMAT) +juvix-format: + @${MAKE} $(TOFORMAT) + .PHONY: check-ormolu check-ormolu: export ORMOLUMODE = check check-ormolu: - @${MAKE} format + @${MAKE} ormolu HLINT?=stack exec -- hlint HLINTFLAGS?= diff --git a/README.md b/README.md new file mode 100644 index 000000000..c74ee3f13 --- /dev/null +++ b/README.md @@ -0,0 +1,144 @@ +# Juvix + +Tara the Juvix mascot + + +| CI Status | +| --------- | +|CI status | +|pages-build-deployment| + + +| Codebase | +| -------- | +|| +| | +|Open the Juvix Standard Lib in Github Codespace | + +Juvix is an open-source, constantly evolving functional programming language +designed for writing privacy-preserving decentralized applications. Using Juvix, developers can write high-level programs which can be compiled to WASM directly, or through [VampIR][vampir] to circuits for private execution with [Taiga][taiga] on [Anoma][anoma] or Ethereum. + +## Getting Started + +To get started with Juvix, head over to the [documentation website][juvix-book] +to learn more about the language and its features. You can also find +installation instructions and tutorials to help you get started with writing +Juvix programs. You can download the [latest release][latest-release] from the +Juvix GitHub repository or use the web-based development environment, [Juvix +Github Codespace][repo-codespace], which provides a pre-configured workspace +ready to use with Juvix and the Haskell toolchain installed. + +## Language features + +Juvix is designed with a focus on safety. The Juvix compiler runs several +static analyses which guarantee the absence of runtime errors. Analyses +performed include termination and type checking. As a result, functional +programs, especially validity predicates, can be written with greater confidence +in their correctness. + +Some language features in Juvix include: + +- Haskell/Agda-like syntax with support for Unicode +- Type inference +- Parametric polymorphism +- User defined inductive data types +- Higher-order functions +- Referential transparency + +The Juvix module system allows developers to break down their programs into +smaller, reusable modules that can be compiled separately and combined to create +larger programs. These modules can be used to build libraries, which can then be +documented using Juvix's built-in documentation generation tool, see for +example, [the Juvix standard library's website][stdlib]. For further details, +please refer to [the Juvix book][juvix-book] which includes +our [latest updates][changelog]. + +## Related projects + +If you're interested in Juvix, you may also want to explore the following related projects: + + +| Project | Description | +| ------- | ----------- | +| [GEB][geb] | Intermediate language for writing compilers and one of the Juvix backends. | +| [VampIR][vampir] | Proof-system-agnostic language for writing arithmetic circuit and one of the GEB backends.| +| [Taiga][taiga] | A framework for generalized shielded state transitions. | + +## Resources + +Here is a summary of resources to help you learn more about Juvix: + +### Documentation + + +| Resource | Description | +| -------- | ----------- | +| [Official website][website] | The official website of Juvix, where you can find documentation, changelog, tutorials, and community resources. | +| [GitHub repository][repo] | The official GitHub repository of Juvix, where you can find the source code and contribute to the project. | + +### Community + + +| Resource | Description | +| -------- | ----------- | +| [Discord community][discord] | The Juvix community on Discord is a space where you can connect with the developers behind Juvix and other members of the community who are passionate about privacy-preserving decentralized applications. It's a place where you can ask for help with using Juvix, discuss the latest features and updates, and get involved in the project. | +| [Twitter][twitter] | The official Twitter account of Juvix, where you can stay up-to-date with the latest news and announcements. | + +### Libraries + + +| Resource | Description | +| -------- | ----------- | +| [Standard library][stdlib] | The Juvix standard library is a collection of pre-written functions and modules that come bundled with the Juvix programming language. It provides developers with a set of common and useful tools that they can use to build their Juvix programs without having to write everything from scratch. | + +### IDE support + + +| Resource | Description | +| -------- | ----------- | +| [VSCode extension][vscode-plugin] | Support for the Juvix programming language with features such as syntax highlighting, error checking and many more directly in the VSCode editor. +| [Emacs Juvix mode][juvix-mode] | A major mode for Emacs that provides support for writing Juvix programs. | + +### Development environments + + +| Resource | Description | +| -------- | ----------- | +| [Juvix Standard Lib Codespace][stdlib-codespace] | A web-based development environment for the Juvix standard library on GitHub. It provides a pre-configured workspace with the Juvix standard library installed and ready to use, so you can start using the library in your projects. Some examples of Juvix programs are also loaded in this environment. | +| [Juvix Github Codespace][repo-codespace] | This codespace provides a pre-configured workspace with Juvix and the Haskell toolchain installed. Everything is ready to use, so you can start developing/inspecting the Juvix compiler right away. | + +### Installation + + +| Resource | Description | +| -------- | ----------- | +| [Homebrew Juvix formula][juvix-formula] | A formula for [Homebrew][homebrew], a package manager for macOS and Linux, that allows you to easily install Juvix on your system. | +| [Juvix Nightly builds][nightly-builds] | Users can download and use these nightly builds to experiment with the latest changes to the Juvix Compiler. Nightly builds may contain new features, bug fixes, and other improvements to Juvix that are still in development and have not yet been released in an official version.| + +## Contributing + +If you're interested in contributing to Juvix, please see the [contributing guidelines](CONTRIBUTING.md) for more information. We welcome contributions of all kinds, from bug reports and feature requests to code contributions and documentation improvements. + +## License + +Juvix is open-source software released under the GNU General Public License v3.0. See the [LICENSE](LICENSE.md) file for more information. + +[anoma]: https://anoma.net +[changelog]: https://anoma.github.io/juvix/changelog.html +[discord]: https://discord.gg/PfaaFVErHt +[geb]: https://github.com/anoma/geb +[homebrew]: https://brew.sh +[juvix-book]: https://docs.juvix.org +[juvix-formula]: https://github.com/anoma/homebrew-juvix +[juvix-mode]: https://github.com/anoma/juvix-mode +[latest-release]: https://github.com/anoma/juvix/releases/latest +[nightly-builds]: https://github.com/anoma/nightly-juvix-builds +[repo-codespace]: https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=102404734&machine=standardLinux32gb&location=WestEurope +[repo]: https://github.com/anoma/juvix +[stdlib-codespace]: https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=102404734&machine=standardLinux32gb&location=WestEurope +[stdlib]: https://github.com/anoma/juvix-stdlib +[taiga]: https://github.com/anoma/taiga +[twitter]: https://twitter.com/juvixlang +[vampir]: https://github.com/anoma/vamp-ir +[vscode-plugin]: https://github.com/anoma/vscode-juvix +[website]: https://juvix.org diff --git a/README.org b/README.org deleted file mode 100644 index 9eed6e204..000000000 --- a/README.org +++ /dev/null @@ -1,84 +0,0 @@ -* Juvix - -#+begin_html - -CI status - -#+end_html - -#+begin_html - -#+end_html - -#+begin_html - - - -#+end_html - -#+begin_html - -LICENSE - -#+end_html - -#+begin_html - -Open the Juvix Standard Lib in Github Codespace - -#+end_html - -#+begin_html - -Juvix Mascot - -#+end_html - - -** Description - -Juvix is a research programming language created by [[https://heliax.dev/][Heliax]] as a first step toward creating more robust and reliable alternatives for formally verified smart contracts than existing languages. The Juvix language is constantly evolving, open-source, functional, and statically typed with special support for compiling [[https://anoma.network/blog/validity-predicates/][validity predicates]] to [[https://webassembly.org/][WebAssembly]], which can be deployed to various distributed ledgers including [[https://anoma.net/][Anoma]]. - -The Juvix language and related tools are documented in [[https://anoma.github.io/juvix/][the Juvix book]]. To write -and test Juvix programs, you can use your favorite text editor, the =juvix= -command line tool, the [[https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=102404734&machine=standardLinux32gb&location=WestEurope][Juvix Github Codespace]], and the [[https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=102404734&machine=standardLinux32gb&location=WestEurope][Juvix Standard Lib Codespace]]. However, we recommend using the =juvix-mode= in [[https://docs.juvix.org/reference/tooling/emacs.html][Emacs]] or the -plugin in [[https://github.com/anoma/vscode-juvix][VSCode]]. - -** Quick start - -See [[https://docs.juvix.org/quick-start.html][Quick start]] to start with Juvix. - -** The Juvix programming language - -Juvix provides a high degree of assurance. The Juvix compiler runs -several static analyses which guarantee the absence of runtime -errors. Analyses performed include termination, arity, and type -checking. As a result, functional programs, especially validity -predicates, can be written with greater confidence in their -correctness. - -Some of the language features in Juvix include: - -- unicode syntax -- parametric polymorphism -- inductive and parametric data types -- higher-order functions -- implicit arguments -- holes in expressions -- axioms for non-computable terms - -The Juvix module system further permits splitting programs into -several modules to build libraries which can be later documented by -generating HTML files based on the codebase, see for example, [[https://anoma.github.io/juvix-stdlib/][the -Juvix standard library's website]]. For further details, please refer to -[[https://anoma.github.io/juvix/][the Juvix book]] which includes our [[https://anoma.github.io/juvix/changelog.html][latest updates]]. - -** Community - -Join us on our [[https://discord.gg/PfaaFVErHt][Discord server]]! - -Juvix is part of a bigger effort called [[https://anoma.net/][Anoma]]. -Anoma is an intent-centric, privacy-preserving protocol for decentralized counterparty discovery, solving, and multi-chain atomic settlement. -Join the [[https://anoma.net/community][Anoma project]]. diff --git a/book.toml b/book.toml index 1552617a0..c81f561ea 100644 --- a/book.toml +++ b/book.toml @@ -3,15 +3,58 @@ title = "The Juvix Book" authors = [ "Jonathan Prieto-Cubides" , "Jan Mas Rovira" , "Paul Cadman" , "Lukasz Czajka" ] language = "en" multilingual = false -src = "docs/md/" +src = "docs" [build] -build-dir = "_docs" create-missing = true -[output.html] -mathjax-support = true +[preprocessor.index] -[preprocessor.toc] -command = "mdbook-toc" -renderer = ["html"] +[preprocessor.links] + +[preprocessor.pagetoc] + +[preprocessor.katex] +renderers = ["html"] +static-css = false +include-src = false +block-delimiter = {left = "$$", right = "$$"} +inline-delimiter = {left = "$", right = "$"} +macros = "theme/latex-macros.txt" + +[output.katex] + +[output.html] +default-theme = "light" +preferred-dark-theme = "Ayu" +copy-fonts = true +additional-css = ["theme/pagetoc.css"] +additional-js = ["theme/pagetoc.js","assets/images/tara-magicien.png", "assets/images/tara-seating.svg", "assets/images/tara-smiling.png", "assets/images/tara-smiling.svg", "assets/images/tara-teaching.png", "assets/images/tara-teaching.svg", "assets/js/highlight.js", "assets/js/tex-chtml.js" ] +no-section-label = false +git-repository-url = "https://github.com/anoma/juvix" +git-repository-icon = "fa-github" + +[output.html.fold] +enable = true # whether or not to enable section folding +level = 0 # the depth to start folding + +[output.html.search] +enable = true # enables the search feature +limit-results = 15 # maximum number of search results +teaser-word-count = 30 # number of words used for a search result teaser +use-boolean-and = true # multiple search terms must all match +boost-title = 2 # ranking boost factor for matches in headers +boost-hierarchy = 1 # ranking boost factor for matches in page names +boost-paragraph = 1 # ranking boost factor for matches in text +expand = true # partial words will match longer terms +heading-split-level = 2 # link results to heading levels +copy-js = true # include Javascript code for search + +[output.linkcheck] +follow-web-links = false +traverse-parent-directories = false +exclude = [ ] +user-agent = "mdbook-linkcheck-0.4.0" +cache-timeout = 43200 +[output.linkcheck.http-headers] +'crates\.io' = ["Accept: text/html"] diff --git a/changelog.org b/changelog.org deleted file mode 100644 index 92f183d9e..000000000 --- a/changelog.org +++ /dev/null @@ -1,1528 +0,0 @@ -* Changelog - -#+begin_html - -Juvix Mascot - -#+end_html -** [[https://github.com/anoma/juvix/tree/v0.3.0][v0.3.0]] (2023-03-15) -[[https://github.com/anoma/juvix/compare/v0.2.9...v0.3.0][Full Changelog]] - -*Implemented enhancements:* - -- Avoid line breaks in applications within a type signature - [[https://github.com/anoma/juvix/issues/1850][#1850]] - ([[https://github.com/paulcadman][paulcadman]]) -- Respect user's spacing decisions in the formatter - [[https://github.com/anoma/juvix/issues/1837][#1837]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Formatter should not transform ASCII symbols to unicode by default - [[https://github.com/anoma/juvix/issues/1827][#1827]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Enable match-to-case, nat-to-int and convert-builtins by default in - REPL [[https://github.com/anoma/juvix/issues/1825][#1825]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- The Juvix formatter works poorly with multi-line ifs - [[https://github.com/anoma/juvix/issues/1793][#1793]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add a lazy IO sequencing function (#1772) - [[https://github.com/anoma/juvix/issues/1773][#1773]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Support LetRec in the GEB backend - [[https://github.com/anoma/juvix/issues/1756][#1756]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Support integers in the GEB backend - [[https://github.com/anoma/juvix/issues/1753][#1753]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- GEB evaluator [[https://github.com/anoma/juvix/issues/1751][#1751]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Add debugging builtin functions - [[https://github.com/anoma/juvix/issues/1731][#1731]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Non-judoc comments are removed when generating HTML output - [[https://github.com/anoma/juvix/issues/1723][#1723]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Special syntax for =case= - [[https://github.com/anoma/juvix/issues/1716][#1716]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Make || and && lazy - [[https://github.com/anoma/juvix/issues/1701][#1701]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- It should be possible to specify multiple implicit type arguments at - once [[https://github.com/anoma/juvix/issues/1692][#1692]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Naive compilation of complex pattern matches with match-expressions to - decision trees with case-expressions - [[https://github.com/anoma/juvix/issues/1531][#1531]] - ([[https://github.com/paulcadman][paulcadman]]) -- New compilation pipeline - [[https://github.com/anoma/juvix/pull/1832][#1832]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Add internal core-eval option to evaluate named function identifier - [[https://github.com/anoma/juvix/pull/1819][#1819]] - ([[https://github.com/paulcadman][paulcadman]]) -- Short syntax for sequences of function and datatype parameters - [[https://github.com/anoma/juvix/pull/1809][#1809]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Add Geb Backend Evaluator with some extra subcommands - [[https://github.com/anoma/juvix/pull/1808][#1808]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Add REPL option to apply Core transformations - [[https://github.com/anoma/juvix/pull/1796][#1796]] - ([[https://github.com/paulcadman][paulcadman]]) -- String builtins [[https://github.com/anoma/juvix/pull/1784][#1784]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Use restore/save github action to speed up the CI testing - [[https://github.com/anoma/juvix/pull/1783][#1783]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Fix minor issue with ==% for type equality - [[https://github.com/anoma/juvix/pull/1780][#1780]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Add debugging builtin functions =trace= and =fail= - [[https://github.com/anoma/juvix/pull/1771][#1771]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Keep regular comments in html output - [[https://github.com/anoma/juvix/pull/1766][#1766]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Lazy boolean operators - [[https://github.com/anoma/juvix/pull/1743][#1743]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Refactor =html= command with extra options - [[https://github.com/anoma/juvix/pull/1725][#1725]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Add initial setup for codespaces - [[https://github.com/anoma/juvix/pull/1713][#1713]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Typecheck let expressions - [[https://github.com/anoma/juvix/pull/1712][#1712]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Use Smoke instead of shelltestrunner - [[https://github.com/anoma/juvix/pull/1710][#1710]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Replace --output-dir flag by --internal-build-dir - [[https://github.com/anoma/juvix/pull/1707][#1707]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Compiler output [[https://github.com/anoma/juvix/pull/1705][#1705]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Allow optional pipe before the first constructor for inductive type - declarations [[https://github.com/anoma/juvix/pull/1699][#1699]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Nat builtins [[https://github.com/anoma/juvix/pull/1686][#1686]] - ([[https://github.com/lukaszcz][lukaszcz]]) - - -*Merged pull requests:* - -- Remove dead code in =Internal= - [[https://github.com/anoma/juvix/pull/1891][#1891]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Remove missing Juvix examples and webapp example from docs build - [[https://github.com/anoma/juvix/pull/1890][#1890]] - ([[https://github.com/paulcadman][paulcadman]]) -- Fix type synonym in let - [[https://github.com/anoma/juvix/pull/1880][#1880]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Update stack resolver to lts-20.12 - [[https://github.com/anoma/juvix/pull/1873][#1873]] - ([[https://github.com/paulcadman][paulcadman]]) -- Use Ape to format patterns - [[https://github.com/anoma/juvix/pull/1870][#1870]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Fix Core-To-Geb translation - [[https://github.com/anoma/juvix/pull/1863][#1863]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Remove the old C backend - [[https://github.com/anoma/juvix/pull/1862][#1862]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Move =substEnv= to its own module - [[https://github.com/anoma/juvix/pull/1861][#1861]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add =_caseTypeWholeExpression= to Internal - [[https://github.com/anoma/juvix/pull/1860][#1860]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- remove old minihaskell files - [[https://github.com/anoma/juvix/pull/1859][#1859]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Fix bugs in the Case translation in Core-to-Geb - [[https://github.com/anoma/juvix/pull/1858][#1858]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Format examples [[https://github.com/anoma/juvix/pull/1856][#1856]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Sort the identifiers topologically in the Core-to-GEB translation - [[https://github.com/anoma/juvix/pull/1854][#1854]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Add type info to the mid-square hashing function - [[https://github.com/anoma/juvix/pull/1853][#1853]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Use APE mechanism to format Function expressions - [[https://github.com/anoma/juvix/pull/1852][#1852]] - ([[https://github.com/paulcadman][paulcadman]]) -- Preserve single wildcards pretty printing function parameters - [[https://github.com/anoma/juvix/pull/1851][#1851]] - ([[https://github.com/paulcadman][paulcadman]]) -- Add type annotation to case expression - [[https://github.com/anoma/juvix/pull/1849][#1849]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Remove module parameters - [[https://github.com/anoma/juvix/pull/1848][#1848]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Allow shadowing local variables with let function definitions - [[https://github.com/anoma/juvix/pull/1847][#1847]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add lambda type info - [[https://github.com/anoma/juvix/pull/1845][#1845]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Improve comma formatting - [[https://github.com/anoma/juvix/pull/1842][#1842]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Improve formatter [[https://github.com/anoma/juvix/pull/1840][#1840]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Respect lambda Ascii/Unicode - [[https://github.com/anoma/juvix/pull/1838][#1838]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Fix =juvix init= [[https://github.com/anoma/juvix/pull/1835][#1835]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- The formatter respects the ascii function arrow - [[https://github.com/anoma/juvix/pull/1834][#1834]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add =dev core from-concrete= command - [[https://github.com/anoma/juvix/pull/1833][#1833]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Give proper errors for incorrect application of lazy builtins - [[https://github.com/anoma/juvix/pull/1830][#1830]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Documentation: update language reference - [[https://github.com/anoma/juvix/pull/1829][#1829]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Add compilation of complex pattern matching to case - [[https://github.com/anoma/juvix/pull/1824][#1824]] - ([[https://github.com/paulcadman][paulcadman]]) -- Apply CI ghcup workaround to docs build - [[https://github.com/anoma/juvix/pull/1823][#1823]] - ([[https://github.com/paulcadman][paulcadman]]) -- Update the Juvix tutorial for 0.3 - [[https://github.com/anoma/juvix/pull/1822][#1822]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Workaround ghcup issue on CI runner - [[https://github.com/anoma/juvix/pull/1821][#1821]] - ([[https://github.com/paulcadman][paulcadman]]) -- Respect the =juvix dev highlight --format= flag when outputting errors - [[https://github.com/anoma/juvix/pull/1820][#1820]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Comments about the usage of the JuvixCore recursors - [[https://github.com/anoma/juvix/pull/1818][#1818]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Emacs mode and VSCode extension tutorials - [[https://github.com/anoma/juvix/pull/1815][#1815]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Documentation: how to compile Juvix programs - [[https://github.com/anoma/juvix/pull/1813][#1813]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Make '>>' lazy [[https://github.com/anoma/juvix/pull/1812][#1812]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Output proper GEB Lisp programs - [[https://github.com/anoma/juvix/pull/1810][#1810]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Remove the usage annotation syntax - [[https://github.com/anoma/juvix/pull/1805][#1805]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Mid-square hashing implemented in JuvixCore - [[https://github.com/anoma/juvix/pull/1804][#1804]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Autocompletion for =dev core compilation --target= - [[https://github.com/anoma/juvix/pull/1803][#1803]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Special syntax for case - [[https://github.com/anoma/juvix/pull/1800][#1800]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Adapt benchmarks to the new pipeline - [[https://github.com/anoma/juvix/pull/1795][#1795]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Support letrec lifting without lambda lifting - [[https://github.com/anoma/juvix/pull/1794][#1794]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Use the reader effect - [[https://github.com/anoma/juvix/pull/1791][#1791]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Remove braces from let expressions - [[https://github.com/anoma/juvix/pull/1790][#1790]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Translate as-pattern binders to Core PatternBinders - [[https://github.com/anoma/juvix/pull/1789][#1789]] - ([[https://github.com/paulcadman][paulcadman]]) -- Fix termination with as-patterns - [[https://github.com/anoma/juvix/pull/1787][#1787]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Allow type signatures to have a body - [[https://github.com/anoma/juvix/pull/1785][#1785]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Track builtins in the Core InfoTable - [[https://github.com/anoma/juvix/pull/1782][#1782]] - ([[https://github.com/paulcadman][paulcadman]]) -- Pipes for lambda clauses - [[https://github.com/anoma/juvix/pull/1781][#1781]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Support integers in the GEB backend - [[https://github.com/anoma/juvix/pull/1778][#1778]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Add builtin nat and bool types as start nodes in reachability analysis - [[https://github.com/anoma/juvix/pull/1775][#1775]] - ([[https://github.com/paulcadman][paulcadman]]) -- Update pre-commit [[https://github.com/anoma/juvix/pull/1772][#1772]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Parse JuvixCore with absolute paths - [[https://github.com/anoma/juvix/pull/1770][#1770]] - ([[https://github.com/paulcadman][paulcadman]]) -- Use absolute path in Core Evaluator to generate source file location - [[https://github.com/anoma/juvix/pull/1769][#1769]] - ([[https://github.com/paulcadman][paulcadman]]) -- Install wasmer binary from Github releases - [[https://github.com/anoma/juvix/pull/1765][#1765]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Run the new Juvix formatter for all the Juvix examples - [[https://github.com/anoma/juvix/pull/1764][#1764]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Fix let expressions in the repl - [[https://github.com/anoma/juvix/pull/1763][#1763]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Improve arity inference for repl expressions - [[https://github.com/anoma/juvix/pull/1762][#1762]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Fix broken links and other improvements - [[https://github.com/anoma/juvix/pull/1761][#1761]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Translate Nat builtins to the correct Core Ops - [[https://github.com/anoma/juvix/pull/1760][#1760]] - ([[https://github.com/paulcadman][paulcadman]]) -- Remove hlint from the CI and pre-commit config - [[https://github.com/anoma/juvix/pull/1759][#1759]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Fix demo example build - [[https://github.com/anoma/juvix/pull/1757][#1757]] - ([[https://github.com/paulcadman][paulcadman]]) -- Basic Geb integration - [[https://github.com/anoma/juvix/pull/1748][#1748]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Fix macOS CI build [[https://github.com/anoma/juvix/pull/1747][#1747]] - ([[https://github.com/paulcadman][paulcadman]]) -- Adapt Juvix programs to the new pipeline - [[https://github.com/anoma/juvix/pull/1746][#1746]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Fix link in README for the new docs - [[https://github.com/anoma/juvix/pull/1745][#1745]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Move juvix-mode to a separate repository - [[https://github.com/anoma/juvix/pull/1744][#1744]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Print comments when pretty printing concrete syntax - [[https://github.com/anoma/juvix/pull/1737][#1737]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Demo [[https://github.com/anoma/juvix/pull/1736][#1736]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Update CI to install Smoke, Github actions, and Makefile fixes - [[https://github.com/anoma/juvix/pull/1735][#1735]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Update stack.yaml [[https://github.com/anoma/juvix/pull/1734][#1734]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Fix Nat builtins [[https://github.com/anoma/juvix/pull/1733][#1733]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Script to count LOC - [[https://github.com/anoma/juvix/pull/1732][#1732]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Give a proper type to literal Strings - [[https://github.com/anoma/juvix/pull/1730][#1730]] - ([[https://github.com/paulcadman][paulcadman]]) -- Do not filter implicit args in internal to core translation - [[https://github.com/anoma/juvix/pull/1728][#1728]] - ([[https://github.com/paulcadman][paulcadman]]) -- Fix de Brujin indexing of lambda arguments - [[https://github.com/anoma/juvix/pull/1727][#1727]] - ([[https://github.com/paulcadman][paulcadman]]) -- Fix inference loop [[https://github.com/anoma/juvix/pull/1726][#1726]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Remove wildcard patterns from Internal - [[https://github.com/anoma/juvix/pull/1724][#1724]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Restructure the documentation and add a tutorial - [[https://github.com/anoma/juvix/pull/1718][#1718]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Improve error message for confusing ':=' with '=' - [[https://github.com/anoma/juvix/pull/1715][#1715]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Fix #1704 [[https://github.com/anoma/juvix/pull/1711][#1711]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Fix #1693 [[https://github.com/anoma/juvix/pull/1708][#1708]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Tests for the new compilation pipeline - [[https://github.com/anoma/juvix/pull/1703][#1703]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Add printString and printBool support to legacy C backend - [[https://github.com/anoma/juvix/pull/1698][#1698]] - ([[https://github.com/paulcadman][paulcadman]]) -- Add --show-de-bruijn option to =juvix repl= - [[https://github.com/anoma/juvix/pull/1694][#1694]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Allow 'terminating' keyword with builtins - [[https://github.com/anoma/juvix/pull/1688][#1688]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Remove unicode cons symbol - [[https://github.com/anoma/juvix/pull/1687][#1687]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Change syntax for ind. data types and forbid the empty data type - [[https://github.com/anoma/juvix/pull/1684][#1684]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Convert Nat literals to Core integers - [[https://github.com/anoma/juvix/pull/1681][#1681]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Less verbose output from running =make check= - [[https://github.com/anoma/juvix/pull/1675][#1675]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Remove where syntax - [[https://github.com/anoma/juvix/pull/1674][#1674]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Benchmarks [[https://github.com/anoma/juvix/pull/1673][#1673]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- JuvixCore to JuvixAsm translation - [[https://github.com/anoma/juvix/pull/1665][#1665]] - ([[https://github.com/lukaszcz][lukaszcz]]) - - -** [[https://github.com/anoma/juvix/tree/v0.2.9][v0.2.9]] (2023-01-18) -[[https://github.com/anoma/juvix/compare/v0.2.8...v0.2.9][Full -Changelog]] - -*Implemented enhancements:* - -- Refactor =html= command with extra options - [[https://github.com/anoma/juvix/pull/1725][#1725]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Add initial setup for codespaces - [[https://github.com/anoma/juvix/pull/1713][#1713]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Typecheck let expressions - [[https://github.com/anoma/juvix/pull/1712][#1712]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Use Smoke instead of shelltestrunner - [[https://github.com/anoma/juvix/pull/1710][#1710]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Replace --output-dir flag by --internal-build-dir - [[https://github.com/anoma/juvix/pull/1707][#1707]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Compiler output [[https://github.com/anoma/juvix/pull/1705][#1705]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Allow optional pipe before the first constructor for inductive type - declarations [[https://github.com/anoma/juvix/pull/1699][#1699]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Nat builtins [[https://github.com/anoma/juvix/pull/1686][#1686]] - ([[https://github.com/lukaszcz][lukaszcz]]) - -*Merged pull requests:* - -- Demo [[https://github.com/anoma/juvix/pull/1736][#1736]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Update stack.yaml [[https://github.com/anoma/juvix/pull/1734][#1734]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Fix Nat builtins [[https://github.com/anoma/juvix/pull/1733][#1733]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Script to count LOC - [[https://github.com/anoma/juvix/pull/1732][#1732]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Give a proper type to literal Strings - [[https://github.com/anoma/juvix/pull/1730][#1730]] - ([[https://github.com/paulcadman][paulcadman]]) -- Do not filter implicit args in internal to core translation - [[https://github.com/anoma/juvix/pull/1728][#1728]] - ([[https://github.com/paulcadman][paulcadman]]) -- Fix de Brujin indexing of lambda arguments - [[https://github.com/anoma/juvix/pull/1727][#1727]] - ([[https://github.com/paulcadman][paulcadman]]) -- Fix inference loop [[https://github.com/anoma/juvix/pull/1726][#1726]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Remove wildcard patterns from Internal - [[https://github.com/anoma/juvix/pull/1724][#1724]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Restructure the documentation and add a tutorial - [[https://github.com/anoma/juvix/pull/1718][#1718]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Improve error message for confusing ':=' with '=' - [[https://github.com/anoma/juvix/pull/1715][#1715]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Fix #1704 [[https://github.com/anoma/juvix/pull/1711][#1711]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Fix #1693 [[https://github.com/anoma/juvix/pull/1708][#1708]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Tests for the new compilation pipeline - [[https://github.com/anoma/juvix/pull/1703][#1703]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Add printString and printBool support to legacy C backend - [[https://github.com/anoma/juvix/pull/1698][#1698]] - ([[https://github.com/paulcadman][paulcadman]]) -- Add --show-de-bruijn option to =juvix repl= - [[https://github.com/anoma/juvix/pull/1694][#1694]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Allow 'terminating' keyword with builtins - [[https://github.com/anoma/juvix/pull/1688][#1688]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Remove unicode cons symbol - [[https://github.com/anoma/juvix/pull/1687][#1687]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Change syntax for ind. data types and forbid the empty data type - [[https://github.com/anoma/juvix/pull/1684][#1684]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Convert Nat literals to Core integers - [[https://github.com/anoma/juvix/pull/1681][#1681]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Less verbose output from running =make check= - [[https://github.com/anoma/juvix/pull/1675][#1675]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Remove where syntax - [[https://github.com/anoma/juvix/pull/1674][#1674]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Benchmarks [[https://github.com/anoma/juvix/pull/1673][#1673]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- JuvixCore to JuvixAsm translation - [[https://github.com/anoma/juvix/pull/1665][#1665]] - ([[https://github.com/lukaszcz][lukaszcz]]) - -** [[https://github.com/anoma/juvix/tree/v0.2.8][v0.2.8]] (2022-12-20) -[[https://github.com/anoma/juvix/compare/v0.2.7...v0.2.8][Full -Changelog]] - -*Implemented enhancements:* - -- Support basic dependencies - [[https://github.com/anoma/juvix/pull/1622][#1622]] - ([[https://github.com/janmasrovira][janmasrovira]]) - -*Merged pull requests:* - -- Refactor hie.yaml and add entry in the readme - [[https://github.com/anoma/juvix/pull/1672][#1672]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Fix inline monospace formatted text in README - [[https://github.com/anoma/juvix/pull/1671][#1671]] - ([[https://github.com/paulcadman][paulcadman]]) -- Pin mdbook to version 0.4.22 in docs build - [[https://github.com/anoma/juvix/pull/1670][#1670]] - ([[https://github.com/paulcadman][paulcadman]]) -- Add option to specify Core transformations to =dev internal core-eval= - [[https://github.com/anoma/juvix/pull/1669][#1669]] - ([[https://github.com/paulcadman][paulcadman]]) -- Revert "Ignore binaries generated by running some tests" - [[https://github.com/anoma/juvix/pull/1668][#1668]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Add configuration files so the project can be built with cabal - [[https://github.com/anoma/juvix/pull/1667][#1667]] - ([[https://github.com/paulcadman][paulcadman]]) -- Add documentation for compiling/running the TicTacToe example - [[https://github.com/anoma/juvix/pull/1664][#1664]] - ([[https://github.com/paulcadman][paulcadman]]) -- Ignore binaries generated by running some tests - [[https://github.com/anoma/juvix/pull/1663][#1663]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Conversion of Nat representation to JuvixCore integers - [[https://github.com/anoma/juvix/pull/1661][#1661]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Move applications inside Lets and Cases - [[https://github.com/anoma/juvix/pull/1659][#1659]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Run shelltests on macOS build - [[https://github.com/anoma/juvix/pull/1658][#1658]] - ([[https://github.com/paulcadman][paulcadman]]) -- Restore macOS CI build/test - [[https://github.com/anoma/juvix/pull/1657][#1657]] - ([[https://github.com/paulcadman][paulcadman]]) -- Remove type arguments and type abstractions from Nodes - [[https://github.com/anoma/juvix/pull/1655][#1655]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Pretty printing of JuvixAsm code - [[https://github.com/anoma/juvix/pull/1650][#1650]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Remove NameId from Core - [[https://github.com/anoma/juvix/pull/1649][#1649]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Translation from JuvixAsm to C - [[https://github.com/anoma/juvix/pull/1619][#1619]] - ([[https://github.com/lukaszcz][lukaszcz]]) - -** [[https://github.com/anoma/juvix/tree/v0.2.7][v0.2.7]] (2022-12-05) -[[https://github.com/anoma/juvix/compare/v0.2.6...v0.2.7][Full -Changelog]] - -*Implemented enhancements:* - -- Add juvix-repl-mode for emacs - [[https://github.com/anoma/juvix/pull/1612][#1612]] - ([[https://github.com/paulcadman][paulcadman]]) -- Make lambda lifting correct when free variables occur in the types of - binders [[https://github.com/anoma/juvix/pull/1609][#1609]] - ([[https://github.com/janmasrovira][janmasrovira]]) - -*Merged pull requests:* - -- Files pure refactor - [[https://github.com/anoma/juvix/pull/1652][#1652]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Use the same stack version in all CI jobs and remove =stack setup= - step [[https://github.com/anoma/juvix/pull/1651][#1651]] - ([[https://github.com/paulcadman][paulcadman]]) -- Fix 'not a primitive type' error message - [[https://github.com/anoma/juvix/pull/1648][#1648]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Upgrade stack snapshot to use ghc-9.2.5 - [[https://github.com/anoma/juvix/pull/1621][#1621]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add an emacs function to restart the REPL - [[https://github.com/anoma/juvix/pull/1618][#1618]] - ([[https://github.com/paulcadman][paulcadman]]) -- Add types to Core functions and constructors when translating from - Internal [[https://github.com/anoma/juvix/pull/1617][#1617]] - ([[https://github.com/paulcadman][paulcadman]]) -- Auto complete argument of 'dev core read -t' - [[https://github.com/anoma/juvix/pull/1616][#1616]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Compute new entrypoint root when loading a file in the REPL - [[https://github.com/anoma/juvix/pull/1615][#1615]] - ([[https://github.com/paulcadman][paulcadman]]) -- Compute maximum runtime stack height in JuvixReg - [[https://github.com/anoma/juvix/pull/1613][#1613]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Remove shelltest threading - [[https://github.com/anoma/juvix/pull/1611][#1611]] - ([[https://github.com/paulcadman][paulcadman]]) -- Use StackInfo and recurseS in the JuvixAsm to JuvixReg translation. - [[https://github.com/anoma/juvix/pull/1610][#1610]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Precompute maximum heap allocation - [[https://github.com/anoma/juvix/pull/1608][#1608]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Improvements to Juvix REPL - [[https://github.com/anoma/juvix/pull/1607][#1607]] - ([[https://github.com/paulcadman][paulcadman]]) -- Fix discrepancy between Juvix and WASM pages - [[https://github.com/anoma/juvix/pull/1605][#1605]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Compute JuvixAsm stack usage info - [[https://github.com/anoma/juvix/pull/1604][#1604]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Improve As-Pattern parsing - [[https://github.com/anoma/juvix/pull/1603][#1603]] - ([[https://github.com/ii8][ii8]]) -- Juvix core recursors should descend into nodes stored in infos - [[https://github.com/anoma/juvix/pull/1600][#1600]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add docs for installing the linux binary - [[https://github.com/anoma/juvix/pull/1599][#1599]] - ([[https://github.com/paulcadman][paulcadman]]) -- Binder refactor [[https://github.com/anoma/juvix/pull/1598][#1598]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Juvix C runtime [[https://github.com/anoma/juvix/pull/1580][#1580]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- As-patterns [[https://github.com/anoma/juvix/pull/1576][#1576]] - ([[https://github.com/ii8][ii8]]) -- Eta expansion at the top of each core function definition (#1481) - [[https://github.com/anoma/juvix/pull/1571][#1571]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add translation from Internal to Core - [[https://github.com/anoma/juvix/pull/1567][#1567]] - ([[https://github.com/paulcadman][paulcadman]]) - -** [[https://github.com/anoma/juvix/tree/v0.2.6][v0.2.6]] (2022-10-26) -[[https://github.com/anoma/juvix/compare/v0.2.5...v0.2.6][Full -Changelog]] - -*Implemented enhancements:* - -- Support go to definition for the standard library - [[https://github.com/anoma/juvix/pull/1592][#1592]] - ([[https://github.com/paulcadman][paulcadman]]) -- Add builtin if [[https://github.com/anoma/juvix/pull/1585][#1585]] - ([[https://github.com/paulcadman][paulcadman]]) -- Add builtin boolean - [[https://github.com/anoma/juvix/pull/1582][#1582]] - ([[https://github.com/paulcadman][paulcadman]]) -- Add lambda expressions to internal and add typechecking support - [[https://github.com/anoma/juvix/pull/1538][#1538]] - ([[https://github.com/janmasrovira][janmasrovira]]) - -*Fixed bugs:* - -- Fix arity checker bug - [[https://github.com/anoma/juvix/pull/1546][#1546]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Look in patterns when building the dependency graph - [[https://github.com/anoma/juvix/pull/1536][#1536]] - ([[https://github.com/janmasrovira][janmasrovira]]) - -*Merged pull requests:* - -- Update language reference to match current state of Juvix - [[https://github.com/anoma/juvix/pull/1594][#1594]] - ([[https://github.com/paulcadman][paulcadman]]) -- Fix letrec printing - [[https://github.com/anoma/juvix/pull/1591][#1591]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Update stdlib submodule with builtin changes - [[https://github.com/anoma/juvix/pull/1589][#1589]] - ([[https://github.com/paulcadman][paulcadman]]) -- Rename builtin natural to nat and boolean to bool - [[https://github.com/anoma/juvix/pull/1588][#1588]] - ([[https://github.com/paulcadman][paulcadman]]) -- Improve the test for eta-expansion of constructors and builtins - [[https://github.com/anoma/juvix/pull/1583][#1583]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Properly newline expressions in the pretty printer - [[https://github.com/anoma/juvix/pull/1581][#1581]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Letrec lifting [[https://github.com/anoma/juvix/pull/1579][#1579]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add softlines between applications and hang definitions - [[https://github.com/anoma/juvix/pull/1578][#1578]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Parse optional type info in JVC files - [[https://github.com/anoma/juvix/pull/1575][#1575]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Fix symbol numbering bug - [[https://github.com/anoma/juvix/pull/1574][#1574]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- 1569 rewrite the test for lambda lifting to use evaluation - [[https://github.com/anoma/juvix/pull/1572][#1572]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Remove lambda from reservedSymbols - [[https://github.com/anoma/juvix/pull/1568][#1568]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Keywords refactor [[https://github.com/anoma/juvix/pull/1566][#1566]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- remove ≔ from the language and replace it by := - [[https://github.com/anoma/juvix/pull/1563][#1563]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- JuvixReg [[https://github.com/anoma/juvix/pull/1551][#1551]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Remove duplicate function in concrete analysis - [[https://github.com/anoma/juvix/pull/1550][#1550]] - ([[https://github.com/ii8][ii8]]) -- Evaluator minor style refactor - [[https://github.com/anoma/juvix/pull/1547][#1547]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Properly handle top lambdas in the termination checker - [[https://github.com/anoma/juvix/pull/1544][#1544]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Mutual inference [[https://github.com/anoma/juvix/pull/1543][#1543]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Autocomplete ".jvc" input files for core {eval, read} commands - [[https://github.com/anoma/juvix/pull/1542][#1542]] - ([[https://github.com/paulcadman][paulcadman]]) -- Add --show-de-bruijn to =core eval= command - [[https://github.com/anoma/juvix/pull/1540][#1540]] - ([[https://github.com/paulcadman][paulcadman]]) -- Inductive types should depend on the types of their constructors - [[https://github.com/anoma/juvix/pull/1537][#1537]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Parser labels [[https://github.com/anoma/juvix/pull/1535][#1535]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- JuvixAsm [[https://github.com/anoma/juvix/pull/1432][#1432]] - ([[https://github.com/lukaszcz][lukaszcz]]) - -** [[https://github.com/anoma/juvix/tree/v0.2.5][v0.2.5]] (2022-09-14) -[[https://github.com/anoma/juvix/compare/v0.2.4...v0.2.5][Full -Changelog]] - -*Fixed bugs:* - -- Properly type check patterns that need normalization - [[https://github.com/anoma/juvix/pull/1472][#1472]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Detect nested patterns as smaller in the termination checker - [[https://github.com/anoma/juvix/pull/1524][#1524]] -- Fix developBeta in Core/Extra.hs - [[https://github.com/anoma/juvix/pull/1487][#1487]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Core/Extra/Recursors/Collector bugfix - [[https://github.com/anoma/juvix/pull/1510][#1510]] - ([[https://github.com/lukaszcz][lukaszcz]]) - -*Merged pull requests:* - -- Replace -> by := in lambda syntax - [[https://github.com/anoma/juvix/pull/1533][#1533]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- 'Match' with complex patterns in Core - [[https://github.com/anoma/juvix/pull/1530][#1530]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Refactor CLI [[https://github.com/anoma/juvix/pull/1527][#1527]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add CanonicalProjection - [[https://github.com/anoma/juvix/pull/1526][#1526]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Make comma a delimiter - [[https://github.com/anoma/juvix/pull/1525][#1525]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Detect nested patterns as smaller in the termination checker - [[https://github.com/anoma/juvix/pull/1524][#1524]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Disallow tab characters as spaces - [[https://github.com/anoma/juvix/pull/1523][#1523]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Refactor =destruct= in Core/Extra/Base - [[https://github.com/anoma/juvix/pull/1522][#1522]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- JuvixCore primitive types - [[https://github.com/anoma/juvix/pull/1521][#1521]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Enable autocompletion for the --theme flag - [[https://github.com/anoma/juvix/pull/1519][#1519]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Stripped version of Core Node datatype - [[https://github.com/anoma/juvix/pull/1518][#1518]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Add =internal core read= command - [[https://github.com/anoma/juvix/pull/1517][#1517]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Implement some instances for BinderList - [[https://github.com/anoma/juvix/pull/1515][#1515]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Back recursor types with type families - [[https://github.com/anoma/juvix/pull/1514][#1514]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Eager evaluation of Constr arguments - [[https://github.com/anoma/juvix/pull/1513][#1513]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Dynamic type in Core - [[https://github.com/anoma/juvix/pull/1508][#1508]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- LetRec in Core [[https://github.com/anoma/juvix/pull/1507][#1507]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Add Haddock and Agda licenses - [[https://github.com/anoma/juvix/pull/1506][#1506]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Fix docs webapp examples CI build - [[https://github.com/anoma/juvix/pull/1505][#1505]] - ([[https://github.com/paulcadman][paulcadman]]) -- Add CLI usage examples doc and integrate with README - [[https://github.com/anoma/juvix/pull/1504][#1504]] - ([[https://github.com/paulcadman][paulcadman]]) -- Refactor BinderInfo - [[https://github.com/anoma/juvix/pull/1503][#1503]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Make =juvix compile= default to native target - [[https://github.com/anoma/juvix/pull/1502][#1502]] - ([[https://github.com/paulcadman][paulcadman]]) -- Refactor Node datatype - [[https://github.com/anoma/juvix/pull/1501][#1501]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Clean up import list in Pipeline - [[https://github.com/anoma/juvix/pull/1499][#1499]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Remove mono [[https://github.com/anoma/juvix/pull/1497][#1497]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Remove Haskell support - [[https://github.com/anoma/juvix/pull/1496][#1496]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Implement lambda lifting - [[https://github.com/anoma/juvix/pull/1494][#1494]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Document Emacs installation and the 'exec-path' problem - [[https://github.com/anoma/juvix/pull/1493][#1493]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Add --allow-different-user to workflow stack command - [[https://github.com/anoma/juvix/pull/1492][#1492]] - ([[https://github.com/paulcadman][paulcadman]]) -- Stack with github actions permissions workaround - [[https://github.com/anoma/juvix/pull/1490][#1490]] - ([[https://github.com/paulcadman][paulcadman]]) -- Restructure recursors and add some lens interfaces - [[https://github.com/anoma/juvix/pull/1489][#1489]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add a github action to build a static linux binary - [[https://github.com/anoma/juvix/pull/1488][#1488]] - ([[https://github.com/paulcadman][paulcadman]]) -- Fix developBeta in Core/Extra.hs - [[https://github.com/anoma/juvix/pull/1487][#1487]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Add an option to show name ids in errors - [[https://github.com/anoma/juvix/pull/1486][#1486]] - ([[https://github.com/lukaszcz][lukaszcz]]) - -** [[https://github.com/anoma/juvix/tree/v0.2.4][v0.2.4]] (2022-08-19) - :PROPERTIES: - :CUSTOM_ID: v0.2.4-2022-08-19 - :END: -[[https://github.com/anoma/juvix/compare/v0.2.3...v0.2.4][Full -Changelog]] - -(Special version for Heliax's retreat in Italy) - -*Implemented enhancements:* - -- Add --stdin flag [[https://github.com/anoma/juvix/pull/1459][#1459]] - ([[https://github.com/janmasrovira][janmasrovira]]) - -*Fixed bugs:* - -- Fix typechecker [[https://github.com/anoma/juvix/pull/1458][#1458]] - ([[https://github.com/janmasrovira][janmasrovira]]) - -*Merged pull requests:* - -- use --stdin in flycheck mode - [[https://github.com/anoma/juvix/pull/1460][#1460]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add a native compile target for demos - [[https://github.com/anoma/juvix/pull/1457][#1457]] - ([[https://github.com/paulcadman][paulcadman]]) -- Small changes for the presentation - [[https://github.com/anoma/juvix/pull/1456][#1456]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Fixes TicTacToe Web example - [[https://github.com/anoma/juvix/pull/1454][#1454]] - ([[https://github.com/paulcadman][paulcadman]]) -- Upgrade to ghc-9.2.4 - [[https://github.com/anoma/juvix/pull/1451][#1451]] - ([[https://github.com/janmasrovira][janmasrovira]]) - - -** [[https://github.com/anoma/juvix/tree/v0.2.3][v0.2.3]] (2022-08-15) - :PROPERTIES: - :CUSTOM_ID: v0.2.3-2022-08-15 - :END: -[[https://github.com/anoma/juvix/compare/v0.2.2...v0.2.3][Full -Changelog]] - -*Implemented enhancements:* - -- add =name= and =version= to =juvix.yaml= - [[https://github.com/anoma/juvix/pull/1422][#1422]] - ([[https://github.com/janmasrovira][janmasrovira]]) - -*Fixed bugs:* - -- Properly handle paragraphs in judoc - [[https://github.com/anoma/juvix/pull/1447][#1447]] - ([[https://github.com/janmasrovira][janmasrovira]]) - -*Merged pull requests:* - -- Give a proper type to literal natural numbers - [[https://github.com/anoma/juvix/pull/1453][#1453]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add the option to output json in the =juvix internal highlight= - command [[https://github.com/anoma/juvix/pull/1450][#1450]] ([[https://github.com/janmasrovira][janmasrovira]]) for supporting the new Juvix Mode for Visual Studio Code ([[https://github.com/anoma/vscode-juvix][jonaprieto]]) -- Allow _ in Wasm exported names to support Anoma signature - [[https://github.com/anoma/juvix/pull/1449][#1449]] - ([[https://github.com/paulcadman][paulcadman]]) -- Add Towers of Hanoi and Pascal triangle examples - [[https://github.com/anoma/juvix/pull/1446][#1446]] - ([[https://github.com/paulcadman][paulcadman]]) -- Add =juvix init= command - [[https://github.com/anoma/juvix/pull/1445][#1445]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Refactor pretty to reduce duplication - [[https://github.com/anoma/juvix/pull/1443][#1443]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add initial support for examples in Html documentation - [[https://github.com/anoma/juvix/pull/1442][#1442]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add revisions to README - [[https://github.com/anoma/juvix/pull/1440][#1440]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- CI: Run build on push to main - [[https://github.com/anoma/juvix/pull/1437][#1437]] - ([[https://github.com/paulcadman][paulcadman]]) -- Add doctor subcommand - [[https://github.com/anoma/juvix/pull/1436][#1436]] - ([[https://github.com/paulcadman][paulcadman]]) -- CI checkout repo before cache and use recommended cache strategy - [[https://github.com/anoma/juvix/pull/1435][#1435]] - ([[https://github.com/paulcadman][paulcadman]]) -- Various documentation adjustments - [[https://github.com/anoma/juvix/pull/1434][#1434]] - ([[https://github.com/paulcadman][paulcadman]]) -- Setup Clang before building docs in CI - [[https://github.com/anoma/juvix/pull/1433][#1433]] - ([[https://github.com/paulcadman][paulcadman]]) -- Major revisions to Makefile - [[https://github.com/anoma/juvix/pull/1431][#1431]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Do not add =-src= suffix to links in HTML when running =juvix html= - [[https://github.com/anoma/juvix/pull/1429][#1429]] - ([[https://github.com/paulcadman][paulcadman]]) -- Add a Web version of TicTacToe - [[https://github.com/anoma/juvix/pull/1427][#1427]] - ([[https://github.com/paulcadman][paulcadman]]) -- WASM import all non-compile axioms with alphanum names in entrypoint - [[https://github.com/anoma/juvix/pull/1426][#1426]] - ([[https://github.com/paulcadman][paulcadman]]) -- Export all functions with alpha numeric names from entrypoint module - [[https://github.com/anoma/juvix/pull/1425][#1425]] - ([[https://github.com/paulcadman][paulcadman]]) -- Refactor [[https://github.com/anoma/juvix/pull/1420][#1420]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Permit axiom without a compile block - [[https://github.com/anoma/juvix/pull/1418][#1418]] - ([[https://github.com/paulcadman][paulcadman]]) -- Implement an html documentation generator similar to haddock (#1413) - [[https://github.com/anoma/juvix/pull/1416][#1416]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Fix version shell test for 0.2.2 - [[https://github.com/anoma/juvix/pull/1415][#1415]] - ([[https://github.com/paulcadman][paulcadman]]) -- Remove Int from stdlib and update SimpleFungibleToken example - [[https://github.com/anoma/juvix/pull/1414][#1414]] - ([[https://github.com/paulcadman][paulcadman]]) - - - -** [[https://github.com/anoma/juvix/tree/v0.2.2][v0.2.2]] (2022-07-25) - :PROPERTIES: - :CUSTOM_ID: v0.2.2-2022-07-25 - :END: -[[https://github.com/anoma/juvix/compare/v0.2.1...v0.2.2][Full -Changelog]] - -*Implemented enhancements:* - -- Compute name dependency graph and filter unreachable definitions - [[https://github.com/anoma/juvix/pull/1408][#1408]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Support type aliases - [[https://github.com/anoma/juvix/pull/1404][#1404]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add debugging custom function to Prelude - [[https://github.com/anoma/juvix/pull/1401][#1401]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Add positivity check for data types - [[https://github.com/anoma/juvix/pull/1393][#1393]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Keep qualified names - [[https://github.com/anoma/juvix/pull/1392][#1392]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Direct translation from MicroJuvix to MiniC - [[https://github.com/anoma/juvix/pull/1386][#1386]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Widens the accepted symbol list - [[https://github.com/anoma/juvix/pull/1385][#1385]] - ([[https://github.com/mariari][mariari]]) -- Check all the type parameter names are different when declaring an - inductive type [[https://github.com/anoma/juvix/pull/1377][#1377]] - ([[https://github.com/jonaprieto][jonaprieto]]) - -*Fixed bugs:* - -- Curly braces are allowed nested in patterns - [[https://github.com/anoma/juvix/pull/1380][#1380]] - ([[https://github.com/janmasrovira][janmasrovira]]) - -*Merged pull requests:* - -- Add =Fail= effect (#1409) - [[https://github.com/anoma/juvix/pull/1411][#1411]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Refactor of typechecking and other checking processes - [[https://github.com/anoma/juvix/pull/1410][#1410]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Use bold for code in scoper error messages - [[https://github.com/anoma/juvix/pull/1403][#1403]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Replace ppSimple by text - [[https://github.com/anoma/juvix/pull/1402][#1402]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Implement some error messages (#1396) - [[https://github.com/anoma/juvix/pull/1400][#1400]] - ([[https://github.com/lukaszcz][lukaszcz]]) -- Refactor childs of pattern parentheses and braces - [[https://github.com/anoma/juvix/pull/1398][#1398]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Update Juvix standard-library - [[https://github.com/anoma/juvix/pull/1389][#1389]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Fix documentation generation - [[https://github.com/anoma/juvix/pull/1387][#1387]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Adds Collatz sequence generator example - [[https://github.com/anoma/juvix/pull/1384][#1384]] - ([[https://github.com/paulcadman][paulcadman]]) -- html-examples [[https://github.com/anoma/juvix/pull/1381][#1381]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Refine hole in type signature to function type - [[https://github.com/anoma/juvix/pull/1379][#1379]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Type checking fails when the type of a pattern is not given by the - signature [[https://github.com/anoma/juvix/pull/1378][#1378]] - ([[https://github.com/janmasrovira][janmasrovira]]) -- Set cname for gh-pages action - [[https://github.com/anoma/juvix/pull/1376][#1376]] - ([[https://github.com/paulcadman][paulcadman]]) -- Add fibonacci sequence example program - [[https://github.com/anoma/juvix/pull/1375][#1375]] - ([[https://github.com/paulcadman][paulcadman]]) -- Fix Changelog links and minors - [[https://github.com/anoma/juvix/pull/1371][#1371]] - ([[https://github.com/jonaprieto][jonaprieto]]) -- Add Version number to the emacs mode - [[https://github.com/anoma/juvix/pull/1320][#1320]] - ([[https://github.com/mariari][mariari]]) - - -** New name: Juvix - -Since version 0.2.2, the project has been renamed from "Mini Juvix" to -"Juvix". The new name reflects the fact that the project is no longer -just a compiler for a subset of Juvix, but a full implementation of the -language. Affected by this change are: - -- Github repository moved from the Heliax organization to the Anoma - organization. "anoma/juvix" is the new repository name. -- All references to "Mini Juvix" have been replaced with "Juvix". Unfortunetly, -due to the move, the old links to the Mini Juvix repository are broken and will -not be fixed. - -** v0.2.1 (2022-07-12) - -*Implemented enhancements:* - -- Specialize commands of/for internal use - MiniJuvix-#270 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Improve handling of location information for different objs - MiniJuvix-#263 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Add issues and PR templates - MiniJuvix-#261 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Throw error when reading a file that conflicts with embedded stdlib - MiniJuvix-#243 - ([[https://github.com/paulcadman][paulcadman]]) -- Embed standard library in the minijuvix binary - MiniJuvix-#210 - ([[https://github.com/paulcadman][paulcadman]]) - -*Fixed bugs:* - -- Fixed a bug with the path to walloc.c - MiniJuvix-#237 - ([[https://github.com/lukaszcz][lukaszcz]]) -- Perform ScopedToAbstract exactly once for each module - MiniJuvix-#223 - ([[https://github.com/paulcadman][paulcadman]]) - -*Merged pull requests:* - -- Label renaming MiniJuvix-#275 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Update link to discord - MiniJuvix-#264 - ([[https://github.com/Romainua][Romainua]]) -- Include =open import= statements when generating HTML - MiniJuvix-#260 - ([[https://github.com/paulcadman][paulcadman]]) -- Renaming MiniJuvix to Juvix - MiniJuvix-#259 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Updates tests to use the updated standard library - MiniJuvix-#253 - ([[https://github.com/paulcadman][paulcadman]]) -- Enforce C99 standard in the generated C files - MiniJuvix-#252 - ([[https://github.com/lukaszcz][lukaszcz]]) -- Restore mascot images to the minijuvix book - MiniJuvix-#250 - ([[https://github.com/paulcadman][paulcadman]]) -- Allow jumping to another module in emacs - MiniJuvix-#249 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Restore Juvix mascot image to README - MiniJuvix-#248 - ([[https://github.com/paulcadman][paulcadman]]) -- Add emacs option =minijuvix-disable-embedded-stdlib= - MiniJuvix-#247 - ([[https://github.com/paulcadman][paulcadman]]) -- Deprecate GHC backend - MiniJuvix-#244 - ([[https://github.com/lukaszcz][lukaszcz]]) -- Removed 'eval' and 'print' keywords (#214) - MiniJuvix-#242 - ([[https://github.com/lukaszcz][lukaszcz]]) -- Add option to disable minijuvix input method - MiniJuvix-#239 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Remove the 'match' keyword - MiniJuvix-#238 - ([[https://github.com/lukaszcz][lukaszcz]]) -- Removed tests/positive/HelloWorld.mjuvix and specified clang version - in the documentation MiniJuvix-#236 - ([[https://github.com/lukaszcz][lukaszcz]]) -- Filter symbol entries properly in the scoper - MiniJuvix-#234 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Use the ModulesCache for =open= statements in ScopedToAbstract pass - MiniJuvix-#224 - ([[https://github.com/paulcadman][paulcadman]]) -- README: Include =--recursive= in git clone command to fetch stdlib - MiniJuvix-#211 - ([[https://github.com/paulcadman][paulcadman]]) -- Update project description v0.2.0 - MiniJuvix-#209 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Unify AST representation of types and expressions in MicroJuvix - MiniJuvix-#188 - ([[https://github.com/janmasrovira][janmasrovira]]) - -** v0.2.0 (2022-06-28) - -*Implemented enhancements:* - -- Support built in types - MiniJuvix-#192 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Support partial application and closure passing in C backend - MiniJuvix-#190 - ([[https://github.com/paulcadman][paulcadman]]) -- Allow =open import= statements - MiniJuvix-#175 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Remove TypeAny and adapt typechecking for literals - MiniJuvix-#173 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Allow holes to be refined into function types - MiniJuvix-#165 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Support implicit arguments - MiniJuvix-#144 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add support for holes in type signatures - MiniJuvix-#141 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Support function closures with no environment in minic - MiniJuvix-#137 - ([[https://github.com/paulcadman][paulcadman]]) -- Add holes for expressions in function clauses and inference support - MiniJuvix-#136 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add "-Oz" optimization flag to clang args - MiniJuvix-#133 - ([[https://github.com/paulcadman][paulcadman]]) -- Add version and help option and root command to the CLI - MiniJuvix-#131 - ([[https://github.com/jonaprieto][jonaprieto]]) - -*Fixed bugs:* - -- Fix: Ignore implicit patterns and arguments in termination checking - MiniJuvix-#172 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Fix: pretty printing for terminating keyword - MiniJuvix-#145 - ([[https://github.com/jonaprieto][jonaprieto]]) - -*Merged pull requests:* - -- Fix: proper error handling for typechecker errors - MiniJuvix-#189 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Add juvix version info and date to HTML output - MiniJuvix-#186 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Fix: Add check for constructor return types - MiniJuvix-#182 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Use Abstract name in Abstract syntax and Micro/MonoJuvix - MiniJuvix-#181 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add an option to specify the path where to put the HTML output - MiniJuvix-#179 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Upgrade to ghc-9.2.3 - MiniJuvix-#178 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Replace dead link in README with a link to the Juvix book - MiniJuvix-#177 - ([[https://github.com/paulcadman][paulcadman]]) -- Embed HTML assets in the juvix binary - MiniJuvix-#176 - ([[https://github.com/paulcadman][paulcadman]]) -- Fix: identifiers with a keyword prefix cannot be parsed - MiniJuvix-#171 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Improve filepath equality - MiniJuvix-#170 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Update validity predicate milestone example to 0.2 syntax - MiniJuvix-#167 - ([[https://github.com/paulcadman][paulcadman]]) -- Fix links in documentation and update to new syntax - MiniJuvix-#163 - ([[https://github.com/paulcadman][paulcadman]]) -- Update stdlib to work with version 0.2 - MiniJuvix-#160 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Update README usage example to use the compile command - MiniJuvix-#158 - ([[https://github.com/paulcadman][paulcadman]]) -- Remove dead code related to the pipeline - MiniJuvix-#156 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add negative test for AppLeftImplicit - MiniJuvix-#154 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add positive test designed for implicit arguments - MiniJuvix-#153 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Remove ExpressionTyped from MicroJuvix - MiniJuvix-#143 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Revision for package.yaml and minor deletions - MiniJuvix-#135 - ([[https://github.com/jonaprieto][jonaprieto]]) - -** v0.1.4 (2022-05-30) - -*Merged pull requests:* - -- Generic Errors and refactoring - MiniJuvix-#123 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Only generates docs if the pull request merges - MiniJuvix-#121 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Add initial docs generation website - MiniJuvix-#119 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Fix internal link in README - MiniJuvix-#116 - ([[https://github.com/paulcadman][paulcadman]]) -- Add minic-runtime for linking without libc - MiniJuvix-#113 - ([[https://github.com/paulcadman][paulcadman]]) -- Add termination checking to the pipeline - MiniJuvix-#111 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Support uncurried higher order functions - MiniJuvix-#110 - ([[https://github.com/paulcadman][paulcadman]]) -- Improve error generation and handling - MiniJuvix-#108 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add MiniC tests with clang+wasi-sdk - MiniJuvix-#105 - ([[https://github.com/paulcadman][paulcadman]]) -- Add usage example and move developer docs - MiniJuvix-#96 - ([[https://github.com/paulcadman][paulcadman]]) -- Refactor warning related stuff - MiniJuvix-#91 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Remove Agda backend - MiniJuvix-#86 - ([[https://github.com/paulcadman][paulcadman]]) - - -*Implemented enhancements:* - -- Add =compile= subcommand to generate binaries - MiniJuvix-#128 -- Add intervals to flycheck errors - MiniJuvix-#124 -- Improve error handling in juvix-mode - MiniJuvix-#107 -- Support multiple modules in compilation - MiniJuvix-#93 -- Add compile command to CLI - MiniJuvix-#130 - ([[https://github.com/paulcadman][paulcadman]]) -- Use Interval in GenericErrors - MiniJuvix-#125 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Remove dev in the CI and other tweaks - MiniJuvix-#118 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Highlight comments correctly - MiniJuvix-#106 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Support multiple modules in compilation - MiniJuvix-#100 - ([[https://github.com/janmasrovira][janmasrovira]]) -- New target syntax and modular VP examples - MiniJuvix-#92 - ([[https://github.com/jonaprieto][jonaprieto]]) - -*Fixed bugs:* - -- Missing error messages when using throw/error - MiniJuvix-#117 -- Fix highlight of comments - MiniJuvix-#104 -- Fix juvix-mode coloring for projects with multiple modules - MiniJuvix-#101 -- Fix =highlight= command for modules with import statements - MiniJuvix-#102 - ([[https://github.com/janmasrovira][janmasrovira]]) - -*Closed issues:* - -- Deprecate the class JuvixError - MiniJuvix-#115 -- Add ToGenericError instance for the infix parsing errors - MiniJuvix-#114 -- Compile to WASM without linking libc - MiniJuvix-#112 -- Add the termination checker to the pipeline - MiniJuvix-#109 -- Use clang + wasi-sdk instead of emcc to compile to WASM - MiniJuvix-#103 -- Move developer tooling docs out of README - MiniJuvix-#95 -- Add pre-commit checks to CI checks - MiniJuvix-#94 -- Support higher order functions in C backend - MiniJuvix-#90 -- Remove dev from the list of branches in the CI - MiniJuvix-#89 -- Refactor warning related stuff - MiniJuvix-#87 -- The Juvix website - MiniJuvix-#51 - - -** v0.1.3 (2022-05-05) - -*Closed issues:* - -- Monomorphisation naming inconsistency - MiniJuvix-#84 -- Remove BackendAgda - MiniJuvix-#83 -- Change terminating keyword behavior - MiniJuvix-#81 -- MonoJuvix =ExpressionTyped= is never used - MiniJuvix-#79 -- Bump stackage nightly and delete =allow-newer: true= from =stack.yaml= - MiniJuvix-#75 -- Generate automatically CHANGELOG and Github Release Notes - MiniJuvix-#73 -- Make flag --show-name-ids global - MiniJuvix-#61 -- Add C code generation backend - MiniJuvix-#60 -- Add polymorphism - MiniJuvix-#59 -- Add the compile keyword to the frontend syntax (support up to Scoping) - MiniJuvix-#58 -- Error with undefined or underscores - MiniJuvix-#54 -- Add support for other GHC and Stack stable version - MiniJuvix-#52 -- Autodetect output ANSI support when prettyprinting - MiniJuvix-#38 -- Terminating for type signatures - MiniJuvix-#11 - -*Merged pull requests:* - -- Remove agda backend - MiniJuvix-#86 - ([[https://github.com/paulcadman][paulcadman]]) -- 84 monomorphisation naming inconsistency - MiniJuvix-#85 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Change terminating keyword behavior - MiniJuvix-#82 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Remove unused constructor ExpressionTyped in Monojuvix - MiniJuvix-#80 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Stricter stack builds and pedantic mode for CI - MiniJuvix-#78 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Bump stackage version and remove allow-newer - MiniJuvix-#76 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add automatically updates/issues/merged PRs to the changelog - MiniJuvix-#74 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Add terminating keyword - MiniJuvix-#71 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Monomorphization - MiniJuvix-#70 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Remove StatementCompile in AST after scoping - MiniJuvix-#69 - ([[https://github.com/paulcadman][paulcadman]]) -- Add C code generation backend - MiniJuvix-#68 - ([[https://github.com/paulcadman][paulcadman]]) -- Check if stderr supports ANSI and print accordingly - MiniJuvix-#67 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Add support for compile (by Jonathan) - MiniJuvix-#66 - ([[https://github.com/paulcadman][paulcadman]]) -- Add NameIdGen effect to the pipeline - MiniJuvix-#64 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Make the =--show-name-ids= flag global - MiniJuvix-#63 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Implement type checker with polymorphism - MiniJuvix-#62 - ([[https://github.com/janmasrovira][janmasrovira]]) - -** v0.1.2 (2022-04-11) - -*Closed issues:* - -- Add en emacs mode with support for scoped highlighting - MiniJuvix-#25 -- Add support for project root detection through a juvix.yaml file - MiniJuvix-#24 -- Add CLI cmd to generate juvix autocompletion files for fish and - zsh MiniJuvix-#23 -- Add pretty and typecheck subcommands to the microjuvix CLI - MiniJuvix-#21 -- Translate identifiers from MicroJuvix to MiniHaskell (valid Haskell) - MiniJuvix-#19 -- Implement the MiniHaskell to Haskell translation (prettyprinter) - MiniJuvix-#18 -- Implementation of a typechecker for MicroJuvix - MiniJuvix-#16 -- Add references to the Abstract AST to update compilation to - MiniHaskell MiniJuvix-#12 -- Order in the house - MiniJuvix-#10 - -*Merged pull requests:* - -- The Juvix project now follows the same goals as the original Juvix - project. MiniJuvix-#7 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Dev→main MiniJuvix-#6 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Big update including termination checking - MiniJuvix-#5 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Parser and scoper - MiniJuvix-#3 - ([[https://github.com/jonaprieto][jonaprieto]]) -- Upgrade to ghc9 and use hpack - MiniJuvix-#2 - ([[https://github.com/janmasrovira][janmasrovira]]) -- Merge MiniJuvix-#1 - ([[https://github.com/jonaprieto][jonaprieto]]) - -** v0.1.1 (2022-03-25) - -- Add support in the parser/scoper for Axiom backends -- Add support for =foreign= keyword -- Add flag =--no-colors= for the scope command -- Upgrade to GHC 9.2.2 -- Improve resolution of local symbols in the scoper -- Several new tests related to ambiguous symbols -- Add =--version= flag -- Add InfoTableBuilder effect for the scoper - -*Closed issues:* - -- Add diff output to the test suite - MiniJuvix-#9 -- Improve scoper ambiguity error messages - MiniJuvix-#8 diff --git a/docker/README.md b/docker/README.md index 5ff481e42..c6d615c1a 100644 --- a/docker/README.md +++ b/docker/README.md @@ -11,7 +11,7 @@ The tag of the image should be prefixed by the location of the GitHub docker repository that you're pushing to. In this case the repository is ` ghcr.io/paulcadman`. -``` shell +```shell docker build -t ghcr.io/paulcadman/ghc-alpine:9.2.6 -f Dockerfile-ghc-alpine-9.2.6 . ``` @@ -26,7 +26,7 @@ https://docs.github.com/en/packages/working-with-a-github-packages-registry/work Set the token to the variable `CR_PAT` and then authenticate: -``` shell +```shell echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin ``` @@ -34,13 +34,13 @@ NB: You do not substitue your username for `USERNAME` in the command above. ## Testing the image -``` shell +```shell docker run -it --rm ghcr.io/paulcadman/ghc-alpine:9.2.6 ``` ## Pushing the image -``` shell +```shell docker push ghcr.io/paulcadman/ghc-alpine:9.2.6 ``` diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md new file mode 100644 index 000000000..3cd8e535c --- /dev/null +++ b/docs/SUMMARY.md @@ -0,0 +1,53 @@ +# Summary + +- [The Juvix project](./README.md) +- [Changelog](./CHANGELOG.md) +- [Quick start](./quick-start.md) + +# Tutorials + +- [Learn Juvix in minutes](./tutorials/learn.md) +- [Structuring Juvix projects](./tutorials/structure.md) +- [Juvix Emacs mode](./tutorials/emacs.md) +- [Juvix VSCode extension](./tutorials/vscode.md) + +# How-to guides + +- [Installing Juvix](./howto/installing.md) +- [Compiling Juvix programs](./howto/compilation.md) +- [Judoc: Juvix documentation tool](./howto/judoc.md) + +# Explanations + +- [Type theory](./explanations/typetheory.md) +- [Totality checking](./explanations/totality/README.md) + - [Termination](./explanations/totality/termination.md) + - [Strictly positive data + types](./explanations/totality/positive.md) + - [Coverage checking](./explanations/totality/coverage.md) + +# Reference + +- [Standard library](./reference/stdlib.md) +- [Language reference](./reference/language/README.md) + - [Functions](./reference/language/functions.md) + - [Data types](./reference/language/datatypes.md) + - [Modules](./reference/language/modules.md) + - [Local definitions](./reference/language/let.md) + - [Control structures](./reference/language/control.md) + - [Comments](./reference/language/comments.md) + - [Axioms](./reference/language/axioms.md) +- [Example programs](./reference/examples.md) +- [Benchmarks](./reference/benchmarks.md) +- [Tooling](./reference/tooling/README.md) + - [Command line interface](./reference/tooling/CLI.md) + - [Doctor](./reference/tooling/doctor.md) + - [Emacs mode](./reference/tooling/emacs.md) + - [Haskell test suite](./reference/tooling/testing.md) +- [Judoc reference](./reference/judoc.md) + +# About + +- [Community](./about/community.md) +- [Contributing](./CONTRIBUTING.md) +- [License](./LICENSE.md) diff --git a/docs/about/community.md b/docs/about/community.md new file mode 100644 index 000000000..1f78b47bc --- /dev/null +++ b/docs/about/community.md @@ -0,0 +1,8 @@ +# Juvix community + +Join us on our [Discord server](https://discord.gg/waYhQ2Qr) + +This project is part of a bigger effort called +[Anoma](https://anoma.net/). Anoma is a suite of protocols and +mechanisms for self-contained, self-sovereign coordination. Join the +[Anoma project](https://anoma.net/community). diff --git a/docs/about/team.md b/docs/about/team.md new file mode 100644 index 000000000..cae719f0f --- /dev/null +++ b/docs/about/team.md @@ -0,0 +1 @@ +# The Juvix Dev Team diff --git a/docs/changelog.md b/docs/changelog.md new file mode 100644 index 000000000..caf7b02c7 --- /dev/null +++ b/docs/changelog.md @@ -0,0 +1,1388 @@ +# Changelog + + +Juvix Mascot + + +## [v0.3.0](https://github.com/anoma/juvix/tree/v0.3.0) (2023-03-15) + +[Full Changelog](https://github.com/anoma/juvix/compare/v0.2.9...v0.3.0) + +**Implemented enhancements:** + +- Avoid line breaks in applications within a type signature + [#1850](https://github.com/anoma/juvix/issues/1850) + ([paulcadman](https://github.com/paulcadman)) +- Respect user's spacing decisions in the formatter + [#1837](https://github.com/anoma/juvix/issues/1837) + ([janmasrovira](https://github.com/janmasrovira)) +- Formatter should not transform ASCII symbols to unicode by default + [#1827](https://github.com/anoma/juvix/issues/1827) + ([janmasrovira](https://github.com/janmasrovira)) +- Enable match-to-case, nat-to-int and convert-builtins by default in + REPL [#1825](https://github.com/anoma/juvix/issues/1825) + ([lukaszcz](https://github.com/lukaszcz)) +- The Juvix formatter works poorly with multi-line ifs + [#1793](https://github.com/anoma/juvix/issues/1793) + ([janmasrovira](https://github.com/janmasrovira)) +- Add a lazy IO sequencing function (#1772) + [#1773](https://github.com/anoma/juvix/issues/1773) + ([lukaszcz](https://github.com/lukaszcz)) +- Support LetRec in the GEB backend + [#1756](https://github.com/anoma/juvix/issues/1756) + ([janmasrovira](https://github.com/janmasrovira)) +- Support integers in the GEB backend + [#1753](https://github.com/anoma/juvix/issues/1753) + ([lukaszcz](https://github.com/lukaszcz)) +- GEB evaluator [#1751](https://github.com/anoma/juvix/issues/1751) + ([jonaprieto](https://github.com/jonaprieto)) +- Add debugging builtin functions + [#1731](https://github.com/anoma/juvix/issues/1731) + ([jonaprieto](https://github.com/jonaprieto)) +- Non-judoc comments are removed when generating HTML output + [#1723](https://github.com/anoma/juvix/issues/1723) + ([janmasrovira](https://github.com/janmasrovira)) +- Special syntax for `case` + [#1716](https://github.com/anoma/juvix/issues/1716) + ([janmasrovira](https://github.com/janmasrovira)) +- Make \|\| and && lazy + [#1701](https://github.com/anoma/juvix/issues/1701) + ([lukaszcz](https://github.com/lukaszcz)) +- It should be possible to specify multiple implicit type arguments at + once [#1692](https://github.com/anoma/juvix/issues/1692) + ([janmasrovira](https://github.com/janmasrovira)) +- Naive compilation of complex pattern matches with match-expressions + to decision trees with case-expressions + [#1531](https://github.com/anoma/juvix/issues/1531) + ([paulcadman](https://github.com/paulcadman)) +- New compilation pipeline + [#1832](https://github.com/anoma/juvix/pull/1832) + ([lukaszcz](https://github.com/lukaszcz)) +- Add internal core-eval option to evaluate named function identifier + [#1819](https://github.com/anoma/juvix/pull/1819) + ([paulcadman](https://github.com/paulcadman)) +- Short syntax for sequences of function and datatype parameters + [#1809](https://github.com/anoma/juvix/pull/1809) + ([lukaszcz](https://github.com/lukaszcz)) +- Add Geb Backend Evaluator with some extra subcommands + [#1808](https://github.com/anoma/juvix/pull/1808) + ([jonaprieto](https://github.com/jonaprieto)) +- Add REPL option to apply Core transformations + [#1796](https://github.com/anoma/juvix/pull/1796) + ([paulcadman](https://github.com/paulcadman)) +- String builtins [#1784](https://github.com/anoma/juvix/pull/1784) + ([lukaszcz](https://github.com/lukaszcz)) +- Use restore/save github action to speed up the CI testing + [#1783](https://github.com/anoma/juvix/pull/1783) + ([jonaprieto](https://github.com/jonaprieto)) +- Fix minor issue with ==% for type equality + [#1780](https://github.com/anoma/juvix/pull/1780) + ([jonaprieto](https://github.com/jonaprieto)) +- Add debugging builtin functions `trace` and `fail` + [#1771](https://github.com/anoma/juvix/pull/1771) + ([jonaprieto](https://github.com/jonaprieto)) +- Keep regular comments in html output + [#1766](https://github.com/anoma/juvix/pull/1766) + ([janmasrovira](https://github.com/janmasrovira)) +- Lazy boolean operators + [#1743](https://github.com/anoma/juvix/pull/1743) + ([lukaszcz](https://github.com/lukaszcz)) +- Refactor `html` command with extra options + [#1725](https://github.com/anoma/juvix/pull/1725) + ([jonaprieto](https://github.com/jonaprieto)) +- Add initial setup for codespaces + [#1713](https://github.com/anoma/juvix/pull/1713) + ([jonaprieto](https://github.com/jonaprieto)) +- Typecheck let expressions + [#1712](https://github.com/anoma/juvix/pull/1712) + ([janmasrovira](https://github.com/janmasrovira)) +- Use Smoke instead of shelltestrunner + [#1710](https://github.com/anoma/juvix/pull/1710) + ([jonaprieto](https://github.com/jonaprieto)) +- Replace –output-dir flag by –internal-build-dir + [#1707](https://github.com/anoma/juvix/pull/1707) + ([jonaprieto](https://github.com/jonaprieto)) +- Compiler output [#1705](https://github.com/anoma/juvix/pull/1705) + ([jonaprieto](https://github.com/jonaprieto)) +- Allow optional pipe before the first constructor for inductive type + declarations [#1699](https://github.com/anoma/juvix/pull/1699) + ([jonaprieto](https://github.com/jonaprieto)) +- Nat builtins [#1686](https://github.com/anoma/juvix/pull/1686) + ([lukaszcz](https://github.com/lukaszcz)) + +**Merged pull requests:** + +- Remove dead code in `Internal` + [#1891](https://github.com/anoma/juvix/pull/1891) + ([janmasrovira](https://github.com/janmasrovira)) +- Remove missing Juvix examples and webapp example from docs build + [#1890](https://github.com/anoma/juvix/pull/1890) + ([paulcadman](https://github.com/paulcadman)) +- Fix type synonym in let + [#1880](https://github.com/anoma/juvix/pull/1880) + ([janmasrovira](https://github.com/janmasrovira)) +- Update stack resolver to lts-20.12 + [#1873](https://github.com/anoma/juvix/pull/1873) + ([paulcadman](https://github.com/paulcadman)) +- Use Ape to format patterns + [#1870](https://github.com/anoma/juvix/pull/1870) + ([janmasrovira](https://github.com/janmasrovira)) +- Fix Core-To-Geb translation + [#1863](https://github.com/anoma/juvix/pull/1863) + ([jonaprieto](https://github.com/jonaprieto)) +- Remove the old C backend + [#1862](https://github.com/anoma/juvix/pull/1862) + ([lukaszcz](https://github.com/lukaszcz)) +- Move `substEnv` to its own module + [#1861](https://github.com/anoma/juvix/pull/1861) + ([janmasrovira](https://github.com/janmasrovira)) +- Add `_caseTypeWholeExpression` to Internal + [#1860](https://github.com/anoma/juvix/pull/1860) + ([janmasrovira](https://github.com/janmasrovira)) +- remove old minihaskell files + [#1859](https://github.com/anoma/juvix/pull/1859) + ([jonaprieto](https://github.com/jonaprieto)) +- Fix bugs in the Case translation in Core-to-Geb + [#1858](https://github.com/anoma/juvix/pull/1858) + ([lukaszcz](https://github.com/lukaszcz)) +- Format examples [#1856](https://github.com/anoma/juvix/pull/1856) + ([janmasrovira](https://github.com/janmasrovira)) +- Sort the identifiers topologically in the Core-to-GEB translation + [#1854](https://github.com/anoma/juvix/pull/1854) + ([lukaszcz](https://github.com/lukaszcz)) +- Add type info to the mid-square hashing function + [#1853](https://github.com/anoma/juvix/pull/1853) + ([lukaszcz](https://github.com/lukaszcz)) +- Use APE mechanism to format Function expressions + [#1852](https://github.com/anoma/juvix/pull/1852) + ([paulcadman](https://github.com/paulcadman)) +- Preserve single wildcards pretty printing function parameters + [#1851](https://github.com/anoma/juvix/pull/1851) + ([paulcadman](https://github.com/paulcadman)) +- Add type annotation to case expression + [#1849](https://github.com/anoma/juvix/pull/1849) + ([janmasrovira](https://github.com/janmasrovira)) +- Remove module parameters + [#1848](https://github.com/anoma/juvix/pull/1848) + ([janmasrovira](https://github.com/janmasrovira)) +- Allow shadowing local variables with let function definitions + [#1847](https://github.com/anoma/juvix/pull/1847) + ([janmasrovira](https://github.com/janmasrovira)) +- Add lambda type info + [#1845](https://github.com/anoma/juvix/pull/1845) + ([janmasrovira](https://github.com/janmasrovira)) +- Improve comma formatting + [#1842](https://github.com/anoma/juvix/pull/1842) + ([janmasrovira](https://github.com/janmasrovira)) +- Improve formatter [#1840](https://github.com/anoma/juvix/pull/1840) + ([janmasrovira](https://github.com/janmasrovira)) +- Respect lambda Ascii/Unicode + [#1838](https://github.com/anoma/juvix/pull/1838) + ([janmasrovira](https://github.com/janmasrovira)) +- Fix `juvix init` [#1835](https://github.com/anoma/juvix/pull/1835) + ([janmasrovira](https://github.com/janmasrovira)) +- The formatter respects the ascii function arrow + [#1834](https://github.com/anoma/juvix/pull/1834) + ([janmasrovira](https://github.com/janmasrovira)) +- Add `dev core from-concrete` command + [#1833](https://github.com/anoma/juvix/pull/1833) + ([janmasrovira](https://github.com/janmasrovira)) +- Give proper errors for incorrect application of lazy builtins + [#1830](https://github.com/anoma/juvix/pull/1830) + ([lukaszcz](https://github.com/lukaszcz)) +- Documentation: update language reference + [#1829](https://github.com/anoma/juvix/pull/1829) + ([lukaszcz](https://github.com/lukaszcz)) +- Add compilation of complex pattern matching to case + [#1824](https://github.com/anoma/juvix/pull/1824) + ([paulcadman](https://github.com/paulcadman)) +- Apply CI ghcup workaround to docs build + [#1823](https://github.com/anoma/juvix/pull/1823) + ([paulcadman](https://github.com/paulcadman)) +- Update the Juvix tutorial for 0.3 + [#1822](https://github.com/anoma/juvix/pull/1822) + ([lukaszcz](https://github.com/lukaszcz)) +- Workaround ghcup issue on CI runner + [#1821](https://github.com/anoma/juvix/pull/1821) + ([paulcadman](https://github.com/paulcadman)) +- Respect the `juvix dev highlight --format` flag when outputting + errors [#1820](https://github.com/anoma/juvix/pull/1820) + ([janmasrovira](https://github.com/janmasrovira)) +- Comments about the usage of the JuvixCore recursors + [#1818](https://github.com/anoma/juvix/pull/1818) + ([lukaszcz](https://github.com/lukaszcz)) +- Emacs mode and VSCode extension tutorials + [#1815](https://github.com/anoma/juvix/pull/1815) + ([lukaszcz](https://github.com/lukaszcz)) +- Documentation: how to compile Juvix programs + [#1813](https://github.com/anoma/juvix/pull/1813) + ([lukaszcz](https://github.com/lukaszcz)) +- Make '\>\>' lazy [#1812](https://github.com/anoma/juvix/pull/1812) + ([lukaszcz](https://github.com/lukaszcz)) +- Output proper GEB Lisp programs + [#1810](https://github.com/anoma/juvix/pull/1810) + ([lukaszcz](https://github.com/lukaszcz)) +- Remove the usage annotation syntax + [#1805](https://github.com/anoma/juvix/pull/1805) + ([lukaszcz](https://github.com/lukaszcz)) +- Mid-square hashing implemented in JuvixCore + [#1804](https://github.com/anoma/juvix/pull/1804) + ([lukaszcz](https://github.com/lukaszcz)) +- Autocompletion for `dev core compilation --target` + [#1803](https://github.com/anoma/juvix/pull/1803) + ([janmasrovira](https://github.com/janmasrovira)) +- Special syntax for case + [#1800](https://github.com/anoma/juvix/pull/1800) + ([janmasrovira](https://github.com/janmasrovira)) +- Adapt benchmarks to the new pipeline + [#1795](https://github.com/anoma/juvix/pull/1795) + ([lukaszcz](https://github.com/lukaszcz)) +- Support letrec lifting without lambda lifting + [#1794](https://github.com/anoma/juvix/pull/1794) + ([janmasrovira](https://github.com/janmasrovira)) +- Use the reader effect + [#1791](https://github.com/anoma/juvix/pull/1791) + ([janmasrovira](https://github.com/janmasrovira)) +- Remove braces from let expressions + [#1790](https://github.com/anoma/juvix/pull/1790) + ([janmasrovira](https://github.com/janmasrovira)) +- Translate as-pattern binders to Core PatternBinders + [#1789](https://github.com/anoma/juvix/pull/1789) + ([paulcadman](https://github.com/paulcadman)) +- Fix termination with as-patterns + [#1787](https://github.com/anoma/juvix/pull/1787) + ([janmasrovira](https://github.com/janmasrovira)) +- Allow type signatures to have a body + [#1785](https://github.com/anoma/juvix/pull/1785) + ([janmasrovira](https://github.com/janmasrovira)) +- Track builtins in the Core InfoTable + [#1782](https://github.com/anoma/juvix/pull/1782) + ([paulcadman](https://github.com/paulcadman)) +- Pipes for lambda clauses + [#1781](https://github.com/anoma/juvix/pull/1781) + ([janmasrovira](https://github.com/janmasrovira)) +- Support integers in the GEB backend + [#1778](https://github.com/anoma/juvix/pull/1778) + ([lukaszcz](https://github.com/lukaszcz)) +- Add builtin nat and bool types as start nodes in reachability + analysis [#1775](https://github.com/anoma/juvix/pull/1775) + ([paulcadman](https://github.com/paulcadman)) +- Update pre-commit [#1772](https://github.com/anoma/juvix/pull/1772) + ([jonaprieto](https://github.com/jonaprieto)) +- Parse JuvixCore with absolute paths + [#1770](https://github.com/anoma/juvix/pull/1770) + ([paulcadman](https://github.com/paulcadman)) +- Use absolute path in Core Evaluator to generate source file location + [#1769](https://github.com/anoma/juvix/pull/1769) + ([paulcadman](https://github.com/paulcadman)) +- Install wasmer binary from Github releases + [#1765](https://github.com/anoma/juvix/pull/1765) + ([jonaprieto](https://github.com/jonaprieto)) +- Run the new Juvix formatter for all the Juvix examples + [#1764](https://github.com/anoma/juvix/pull/1764) + ([jonaprieto](https://github.com/jonaprieto)) +- Fix let expressions in the repl + [#1763](https://github.com/anoma/juvix/pull/1763) + ([janmasrovira](https://github.com/janmasrovira)) +- Improve arity inference for repl expressions + [#1762](https://github.com/anoma/juvix/pull/1762) + ([janmasrovira](https://github.com/janmasrovira)) +- Fix broken links and other improvements + [#1761](https://github.com/anoma/juvix/pull/1761) + ([jonaprieto](https://github.com/jonaprieto)) +- Translate Nat builtins to the correct Core Ops + [#1760](https://github.com/anoma/juvix/pull/1760) + ([paulcadman](https://github.com/paulcadman)) +- Remove hlint from the CI and pre-commit config + [#1759](https://github.com/anoma/juvix/pull/1759) + ([jonaprieto](https://github.com/jonaprieto)) +- Fix demo example build + [#1757](https://github.com/anoma/juvix/pull/1757) + ([paulcadman](https://github.com/paulcadman)) +- Basic Geb integration + [#1748](https://github.com/anoma/juvix/pull/1748) + ([lukaszcz](https://github.com/lukaszcz)) +- Fix macOS CI build [#1747](https://github.com/anoma/juvix/pull/1747) + ([paulcadman](https://github.com/paulcadman)) +- Adapt Juvix programs to the new pipeline + [#1746](https://github.com/anoma/juvix/pull/1746) + ([lukaszcz](https://github.com/lukaszcz)) +- Fix link in README for the new docs + [#1745](https://github.com/anoma/juvix/pull/1745) + ([lukaszcz](https://github.com/lukaszcz)) +- Move juvix-mode to a separate repository + [#1744](https://github.com/anoma/juvix/pull/1744) + ([jonaprieto](https://github.com/jonaprieto)) +- Print comments when pretty printing concrete syntax + [#1737](https://github.com/anoma/juvix/pull/1737) + ([janmasrovira](https://github.com/janmasrovira)) +- Demo [#1736](https://github.com/anoma/juvix/pull/1736) + ([lukaszcz](https://github.com/lukaszcz)) +- Update CI to install Smoke, Github actions, and Makefile fixes + [#1735](https://github.com/anoma/juvix/pull/1735) + ([jonaprieto](https://github.com/jonaprieto)) +- Update stack.yaml [#1734](https://github.com/anoma/juvix/pull/1734) + ([jonaprieto](https://github.com/jonaprieto)) +- Fix Nat builtins [#1733](https://github.com/anoma/juvix/pull/1733) + ([lukaszcz](https://github.com/lukaszcz)) +- Script to count LOC + [#1732](https://github.com/anoma/juvix/pull/1732) + ([lukaszcz](https://github.com/lukaszcz)) +- Give a proper type to literal Strings + [#1730](https://github.com/anoma/juvix/pull/1730) + ([paulcadman](https://github.com/paulcadman)) +- Do not filter implicit args in internal to core translation + [#1728](https://github.com/anoma/juvix/pull/1728) + ([paulcadman](https://github.com/paulcadman)) +- Fix de Brujin indexing of lambda arguments + [#1727](https://github.com/anoma/juvix/pull/1727) + ([paulcadman](https://github.com/paulcadman)) +- Fix inference loop [#1726](https://github.com/anoma/juvix/pull/1726) + ([janmasrovira](https://github.com/janmasrovira)) +- Remove wildcard patterns from Internal + [#1724](https://github.com/anoma/juvix/pull/1724) + ([janmasrovira](https://github.com/janmasrovira)) +- Restructure the documentation and add a tutorial + [#1718](https://github.com/anoma/juvix/pull/1718) + ([lukaszcz](https://github.com/lukaszcz)) +- Improve error message for confusing ':=' with '=' + [#1715](https://github.com/anoma/juvix/pull/1715) + ([lukaszcz](https://github.com/lukaszcz)) +- Fix #1704 [#1711](https://github.com/anoma/juvix/pull/1711) + ([janmasrovira](https://github.com/janmasrovira)) +- Fix #1693 [#1708](https://github.com/anoma/juvix/pull/1708) + ([janmasrovira](https://github.com/janmasrovira)) +- Tests for the new compilation pipeline + [#1703](https://github.com/anoma/juvix/pull/1703) + ([lukaszcz](https://github.com/lukaszcz)) +- Add printString and printBool support to legacy C backend + [#1698](https://github.com/anoma/juvix/pull/1698) + ([paulcadman](https://github.com/paulcadman)) +- Add –show-de-bruijn option to `juvix repl` + [#1694](https://github.com/anoma/juvix/pull/1694) + ([lukaszcz](https://github.com/lukaszcz)) +- Allow 'terminating' keyword with builtins + [#1688](https://github.com/anoma/juvix/pull/1688) + ([lukaszcz](https://github.com/lukaszcz)) +- Remove unicode cons symbol + [#1687](https://github.com/anoma/juvix/pull/1687) + ([lukaszcz](https://github.com/lukaszcz)) +- Change syntax for ind. data types and forbid the empty data type + [#1684](https://github.com/anoma/juvix/pull/1684) + ([jonaprieto](https://github.com/jonaprieto)) +- Convert Nat literals to Core integers + [#1681](https://github.com/anoma/juvix/pull/1681) + ([lukaszcz](https://github.com/lukaszcz)) +- Less verbose output from running `make check` + [#1675](https://github.com/anoma/juvix/pull/1675) + ([jonaprieto](https://github.com/jonaprieto)) +- Remove where syntax + [#1674](https://github.com/anoma/juvix/pull/1674) + ([jonaprieto](https://github.com/jonaprieto)) +- Benchmarks [#1673](https://github.com/anoma/juvix/pull/1673) + ([janmasrovira](https://github.com/janmasrovira)) +- JuvixCore to JuvixAsm translation + [#1665](https://github.com/anoma/juvix/pull/1665) + ([lukaszcz](https://github.com/lukaszcz)) + +## [v0.2.9](https://github.com/anoma/juvix/tree/v0.2.9) (2023-01-18) + +[Full Changelog](https://github.com/anoma/juvix/compare/v0.2.8...v0.2.9) + +**Implemented enhancements:** + +- Refactor `html` command with extra options + [#1725](https://github.com/anoma/juvix/pull/1725) + ([jonaprieto](https://github.com/jonaprieto)) +- Add initial setup for codespaces + [#1713](https://github.com/anoma/juvix/pull/1713) + ([jonaprieto](https://github.com/jonaprieto)) +- Typecheck let expressions + [#1712](https://github.com/anoma/juvix/pull/1712) + ([janmasrovira](https://github.com/janmasrovira)) +- Use Smoke instead of shelltestrunner + [#1710](https://github.com/anoma/juvix/pull/1710) + ([jonaprieto](https://github.com/jonaprieto)) +- Replace –output-dir flag by –internal-build-dir + [#1707](https://github.com/anoma/juvix/pull/1707) + ([jonaprieto](https://github.com/jonaprieto)) +- Compiler output [#1705](https://github.com/anoma/juvix/pull/1705) + ([jonaprieto](https://github.com/jonaprieto)) +- Allow optional pipe before the first constructor for inductive type + declarations [#1699](https://github.com/anoma/juvix/pull/1699) + ([jonaprieto](https://github.com/jonaprieto)) +- Nat builtins [#1686](https://github.com/anoma/juvix/pull/1686) + ([lukaszcz](https://github.com/lukaszcz)) + +**Merged pull requests:** + +- Demo [#1736](https://github.com/anoma/juvix/pull/1736) + ([lukaszcz](https://github.com/lukaszcz)) +- Update stack.yaml [#1734](https://github.com/anoma/juvix/pull/1734) + ([jonaprieto](https://github.com/jonaprieto)) +- Fix Nat builtins [#1733](https://github.com/anoma/juvix/pull/1733) + ([lukaszcz](https://github.com/lukaszcz)) +- Script to count LOC + [#1732](https://github.com/anoma/juvix/pull/1732) + ([lukaszcz](https://github.com/lukaszcz)) +- Give a proper type to literal Strings + [#1730](https://github.com/anoma/juvix/pull/1730) + ([paulcadman](https://github.com/paulcadman)) +- Do not filter implicit args in internal to core translation + [#1728](https://github.com/anoma/juvix/pull/1728) + ([paulcadman](https://github.com/paulcadman)) +- Fix de Brujin indexing of lambda arguments + [#1727](https://github.com/anoma/juvix/pull/1727) + ([paulcadman](https://github.com/paulcadman)) +- Fix inference loop [#1726](https://github.com/anoma/juvix/pull/1726) + ([janmasrovira](https://github.com/janmasrovira)) +- Remove wildcard patterns from Internal + [#1724](https://github.com/anoma/juvix/pull/1724) + ([janmasrovira](https://github.com/janmasrovira)) +- Restructure the documentation and add a tutorial + [#1718](https://github.com/anoma/juvix/pull/1718) + ([lukaszcz](https://github.com/lukaszcz)) +- Improve error message for confusing ':=' with '=' + [#1715](https://github.com/anoma/juvix/pull/1715) + ([lukaszcz](https://github.com/lukaszcz)) +- Fix #1704 [#1711](https://github.com/anoma/juvix/pull/1711) + ([janmasrovira](https://github.com/janmasrovira)) +- Fix #1693 [#1708](https://github.com/anoma/juvix/pull/1708) + ([janmasrovira](https://github.com/janmasrovira)) +- Tests for the new compilation pipeline + [#1703](https://github.com/anoma/juvix/pull/1703) + ([lukaszcz](https://github.com/lukaszcz)) +- Add printString and printBool support to legacy C backend + [#1698](https://github.com/anoma/juvix/pull/1698) + ([paulcadman](https://github.com/paulcadman)) +- Add –show-de-bruijn option to `juvix repl` + [#1694](https://github.com/anoma/juvix/pull/1694) + ([lukaszcz](https://github.com/lukaszcz)) +- Allow 'terminating' keyword with builtins + [#1688](https://github.com/anoma/juvix/pull/1688) + ([lukaszcz](https://github.com/lukaszcz)) +- Remove unicode cons symbol + [#1687](https://github.com/anoma/juvix/pull/1687) + ([lukaszcz](https://github.com/lukaszcz)) +- Change syntax for ind. data types and forbid the empty data type + [#1684](https://github.com/anoma/juvix/pull/1684) + ([jonaprieto](https://github.com/jonaprieto)) +- Convert Nat literals to Core integers + [#1681](https://github.com/anoma/juvix/pull/1681) + ([lukaszcz](https://github.com/lukaszcz)) +- Less verbose output from running `make check` + [#1675](https://github.com/anoma/juvix/pull/1675) + ([jonaprieto](https://github.com/jonaprieto)) +- Remove where syntax + [#1674](https://github.com/anoma/juvix/pull/1674) + ([jonaprieto](https://github.com/jonaprieto)) +- Benchmarks [#1673](https://github.com/anoma/juvix/pull/1673) + ([janmasrovira](https://github.com/janmasrovira)) +- JuvixCore to JuvixAsm translation + [#1665](https://github.com/anoma/juvix/pull/1665) + ([lukaszcz](https://github.com/lukaszcz)) + +## [v0.2.8](https://github.com/anoma/juvix/tree/v0.2.8) (2022-12-20) + +[Full Changelog](https://github.com/anoma/juvix/compare/v0.2.7...v0.2.8) + +**Implemented enhancements:** + +- Support basic dependencies + [#1622](https://github.com/anoma/juvix/pull/1622) + ([janmasrovira](https://github.com/janmasrovira)) + +**Merged pull requests:** + +- Refactor hie.yaml and add entry in the readme + [#1672](https://github.com/anoma/juvix/pull/1672) + ([janmasrovira](https://github.com/janmasrovira)) +- Fix inline monospace formatted text in README + [#1671](https://github.com/anoma/juvix/pull/1671) + ([paulcadman](https://github.com/paulcadman)) +- Pin mdbook to version 0.4.22 in docs build + [#1670](https://github.com/anoma/juvix/pull/1670) + ([paulcadman](https://github.com/paulcadman)) +- Add option to specify Core transformations to + `dev internal core-eval` + [#1669](https://github.com/anoma/juvix/pull/1669) + ([paulcadman](https://github.com/paulcadman)) +- Revert "Ignore binaries generated by running some tests" + [#1668](https://github.com/anoma/juvix/pull/1668) + ([jonaprieto](https://github.com/jonaprieto)) +- Add configuration files so the project can be built with cabal + [#1667](https://github.com/anoma/juvix/pull/1667) + ([paulcadman](https://github.com/paulcadman)) +- Add documentation for compiling/running the TicTacToe example + [#1664](https://github.com/anoma/juvix/pull/1664) + ([paulcadman](https://github.com/paulcadman)) +- Ignore binaries generated by running some tests + [#1663](https://github.com/anoma/juvix/pull/1663) + ([jonaprieto](https://github.com/jonaprieto)) +- Conversion of Nat representation to JuvixCore integers + [#1661](https://github.com/anoma/juvix/pull/1661) + ([lukaszcz](https://github.com/lukaszcz)) +- Move applications inside Lets and Cases + [#1659](https://github.com/anoma/juvix/pull/1659) + ([lukaszcz](https://github.com/lukaszcz)) +- Run shelltests on macOS build + [#1658](https://github.com/anoma/juvix/pull/1658) + ([paulcadman](https://github.com/paulcadman)) +- Restore macOS CI build/test + [#1657](https://github.com/anoma/juvix/pull/1657) + ([paulcadman](https://github.com/paulcadman)) +- Remove type arguments and type abstractions from Nodes + [#1655](https://github.com/anoma/juvix/pull/1655) + ([lukaszcz](https://github.com/lukaszcz)) +- Pretty printing of JuvixAsm code + [#1650](https://github.com/anoma/juvix/pull/1650) + ([lukaszcz](https://github.com/lukaszcz)) +- Remove NameId from Core + [#1649](https://github.com/anoma/juvix/pull/1649) + ([lukaszcz](https://github.com/lukaszcz)) +- Translation from JuvixAsm to C + [#1619](https://github.com/anoma/juvix/pull/1619) + ([lukaszcz](https://github.com/lukaszcz)) + +## [v0.2.7](https://github.com/anoma/juvix/tree/v0.2.7) (2022-12-05) + +[Full Changelog](https://github.com/anoma/juvix/compare/v0.2.6...v0.2.7) + +**Implemented enhancements:** + +- Add juvix-repl-mode for emacs + [#1612](https://github.com/anoma/juvix/pull/1612) + ([paulcadman](https://github.com/paulcadman)) +- Make lambda lifting correct when free variables occur in the types + of binders [#1609](https://github.com/anoma/juvix/pull/1609) + ([janmasrovira](https://github.com/janmasrovira)) + +**Merged pull requests:** + +- Files pure refactor + [#1652](https://github.com/anoma/juvix/pull/1652) + ([janmasrovira](https://github.com/janmasrovira)) +- Use the same stack version in all CI jobs and remove `stack setup` + step [#1651](https://github.com/anoma/juvix/pull/1651) + ([paulcadman](https://github.com/paulcadman)) +- Fix 'not a primitive type' error message + [#1648](https://github.com/anoma/juvix/pull/1648) + ([lukaszcz](https://github.com/lukaszcz)) +- Upgrade stack snapshot to use ghc-9.2.5 + [#1621](https://github.com/anoma/juvix/pull/1621) + ([janmasrovira](https://github.com/janmasrovira)) +- Add an emacs function to restart the REPL + [#1618](https://github.com/anoma/juvix/pull/1618) + ([paulcadman](https://github.com/paulcadman)) +- Add types to Core functions and constructors when translating from + Internal [#1617](https://github.com/anoma/juvix/pull/1617) + ([paulcadman](https://github.com/paulcadman)) +- Auto complete argument of 'dev core read -t' + [#1616](https://github.com/anoma/juvix/pull/1616) + ([janmasrovira](https://github.com/janmasrovira)) +- Compute new entrypoint root when loading a file in the REPL + [#1615](https://github.com/anoma/juvix/pull/1615) + ([paulcadman](https://github.com/paulcadman)) +- Compute maximum runtime stack height in JuvixReg + [#1613](https://github.com/anoma/juvix/pull/1613) + ([lukaszcz](https://github.com/lukaszcz)) +- Remove shelltest threading + [#1611](https://github.com/anoma/juvix/pull/1611) + ([paulcadman](https://github.com/paulcadman)) +- Use StackInfo and recurseS in the JuvixAsm to JuvixReg translation. + [#1610](https://github.com/anoma/juvix/pull/1610) + ([lukaszcz](https://github.com/lukaszcz)) +- Precompute maximum heap allocation + [#1608](https://github.com/anoma/juvix/pull/1608) + ([lukaszcz](https://github.com/lukaszcz)) +- Improvements to Juvix REPL + [#1607](https://github.com/anoma/juvix/pull/1607) + ([paulcadman](https://github.com/paulcadman)) +- Fix discrepancy between Juvix and WASM pages + [#1605](https://github.com/anoma/juvix/pull/1605) + ([lukaszcz](https://github.com/lukaszcz)) +- Compute JuvixAsm stack usage info + [#1604](https://github.com/anoma/juvix/pull/1604) + ([lukaszcz](https://github.com/lukaszcz)) +- Improve As-Pattern parsing + [#1603](https://github.com/anoma/juvix/pull/1603) + ([ii8](https://github.com/ii8)) +- Juvix core recursors should descend into nodes stored in infos + [#1600](https://github.com/anoma/juvix/pull/1600) + ([janmasrovira](https://github.com/janmasrovira)) +- Add docs for installing the linux binary + [#1599](https://github.com/anoma/juvix/pull/1599) + ([paulcadman](https://github.com/paulcadman)) +- Binder refactor [#1598](https://github.com/anoma/juvix/pull/1598) + ([janmasrovira](https://github.com/janmasrovira)) +- Juvix C runtime [#1580](https://github.com/anoma/juvix/pull/1580) + ([lukaszcz](https://github.com/lukaszcz)) +- As-patterns [#1576](https://github.com/anoma/juvix/pull/1576) + ([ii8](https://github.com/ii8)) +- Eta expansion at the top of each core function definition (#1481) + [#1571](https://github.com/anoma/juvix/pull/1571) + ([janmasrovira](https://github.com/janmasrovira)) +- Add translation from Internal to Core + [#1567](https://github.com/anoma/juvix/pull/1567) + ([paulcadman](https://github.com/paulcadman)) + +## [v0.2.6](https://github.com/anoma/juvix/tree/v0.2.6) (2022-10-26) + +[Full Changelog](https://github.com/anoma/juvix/compare/v0.2.5...v0.2.6) + +**Implemented enhancements:** + +- Support go to definition for the standard library + [#1592](https://github.com/anoma/juvix/pull/1592) + ([paulcadman](https://github.com/paulcadman)) +- Add builtin if [#1585](https://github.com/anoma/juvix/pull/1585) + ([paulcadman](https://github.com/paulcadman)) +- Add builtin boolean + [#1582](https://github.com/anoma/juvix/pull/1582) + ([paulcadman](https://github.com/paulcadman)) +- Add lambda expressions to internal and add typechecking support + [#1538](https://github.com/anoma/juvix/pull/1538) + ([janmasrovira](https://github.com/janmasrovira)) + +**Fixed bugs:** + +- Fix arity checker bug + [#1546](https://github.com/anoma/juvix/pull/1546) + ([janmasrovira](https://github.com/janmasrovira)) +- Look in patterns when building the dependency graph + [#1536](https://github.com/anoma/juvix/pull/1536) + ([janmasrovira](https://github.com/janmasrovira)) + +**Merged pull requests:** + +- Update language reference to match current state of Juvix + [#1594](https://github.com/anoma/juvix/pull/1594) + ([paulcadman](https://github.com/paulcadman)) +- Fix letrec printing + [#1591](https://github.com/anoma/juvix/pull/1591) + ([janmasrovira](https://github.com/janmasrovira)) +- Update stdlib submodule with builtin changes + [#1589](https://github.com/anoma/juvix/pull/1589) + ([paulcadman](https://github.com/paulcadman)) +- Rename builtin natural to nat and boolean to bool + [#1588](https://github.com/anoma/juvix/pull/1588) + ([paulcadman](https://github.com/paulcadman)) +- Improve the test for eta-expansion of constructors and builtins + [#1583](https://github.com/anoma/juvix/pull/1583) + ([lukaszcz](https://github.com/lukaszcz)) +- Properly newline expressions in the pretty printer + [#1581](https://github.com/anoma/juvix/pull/1581) + ([janmasrovira](https://github.com/janmasrovira)) +- Letrec lifting [#1579](https://github.com/anoma/juvix/pull/1579) + ([janmasrovira](https://github.com/janmasrovira)) +- Add softlines between applications and hang definitions + [#1578](https://github.com/anoma/juvix/pull/1578) + ([janmasrovira](https://github.com/janmasrovira)) +- Parse optional type info in JVC files + [#1575](https://github.com/anoma/juvix/pull/1575) + ([lukaszcz](https://github.com/lukaszcz)) +- Fix symbol numbering bug + [#1574](https://github.com/anoma/juvix/pull/1574) + ([lukaszcz](https://github.com/lukaszcz)) +- 1569 rewrite the test for lambda lifting to use evaluation + [#1572](https://github.com/anoma/juvix/pull/1572) + ([janmasrovira](https://github.com/janmasrovira)) +- Remove lambda from reservedSymbols + [#1568](https://github.com/anoma/juvix/pull/1568) + ([lukaszcz](https://github.com/lukaszcz)) +- Keywords refactor [#1566](https://github.com/anoma/juvix/pull/1566) + ([janmasrovira](https://github.com/janmasrovira)) +- remove ≔ from the language and replace it by := + [#1563](https://github.com/anoma/juvix/pull/1563) + ([janmasrovira](https://github.com/janmasrovira)) +- JuvixReg [#1551](https://github.com/anoma/juvix/pull/1551) + ([lukaszcz](https://github.com/lukaszcz)) +- Remove duplicate function in concrete analysis + [#1550](https://github.com/anoma/juvix/pull/1550) + ([ii8](https://github.com/ii8)) +- Evaluator minor style refactor + [#1547](https://github.com/anoma/juvix/pull/1547) + ([janmasrovira](https://github.com/janmasrovira)) +- Properly handle top lambdas in the termination checker + [#1544](https://github.com/anoma/juvix/pull/1544) + ([janmasrovira](https://github.com/janmasrovira)) +- Mutual inference [#1543](https://github.com/anoma/juvix/pull/1543) + ([janmasrovira](https://github.com/janmasrovira)) +- Autocomplete ".jvc" input files for core {eval, read} commands + [#1542](https://github.com/anoma/juvix/pull/1542) + ([paulcadman](https://github.com/paulcadman)) +- Add –show-de-bruijn to `core eval` command + [#1540](https://github.com/anoma/juvix/pull/1540) + ([paulcadman](https://github.com/paulcadman)) +- Inductive types should depend on the types of their constructors + [#1537](https://github.com/anoma/juvix/pull/1537) + ([lukaszcz](https://github.com/lukaszcz)) +- Parser labels [#1535](https://github.com/anoma/juvix/pull/1535) + ([janmasrovira](https://github.com/janmasrovira)) +- JuvixAsm [#1432](https://github.com/anoma/juvix/pull/1432) + ([lukaszcz](https://github.com/lukaszcz)) + +## [v0.2.5](https://github.com/anoma/juvix/tree/v0.2.5) (2022-09-14) + +[Full Changelog](https://github.com/anoma/juvix/compare/v0.2.4...v0.2.5) + +**Fixed bugs:** + +- Properly type check patterns that need normalization + [#1472](https://github.com/anoma/juvix/pull/1472) + ([janmasrovira](https://github.com/janmasrovira)) +- Detect nested patterns as smaller in the termination checker + [#1524](https://github.com/anoma/juvix/pull/1524) +- Fix developBeta in Core/Extra.hs + [#1487](https://github.com/anoma/juvix/pull/1487) + ([lukaszcz](https://github.com/lukaszcz)) +- Core/Extra/Recursors/Collector bugfix + [#1510](https://github.com/anoma/juvix/pull/1510) + ([lukaszcz](https://github.com/lukaszcz)) + +**Merged pull requests:** + +- Replace -\> by := in lambda syntax + [#1533](https://github.com/anoma/juvix/pull/1533) + ([janmasrovira](https://github.com/janmasrovira)) +- 'Match' with complex patterns in Core + [#1530](https://github.com/anoma/juvix/pull/1530) + ([lukaszcz](https://github.com/lukaszcz)) +- Refactor CLI [#1527](https://github.com/anoma/juvix/pull/1527) + ([janmasrovira](https://github.com/janmasrovira)) +- Add CanonicalProjection + [#1526](https://github.com/anoma/juvix/pull/1526) + ([janmasrovira](https://github.com/janmasrovira)) +- Make comma a delimiter + [#1525](https://github.com/anoma/juvix/pull/1525) + ([lukaszcz](https://github.com/lukaszcz)) +- Detect nested patterns as smaller in the termination checker + [#1524](https://github.com/anoma/juvix/pull/1524) + ([janmasrovira](https://github.com/janmasrovira)) +- Disallow tab characters as spaces + [#1523](https://github.com/anoma/juvix/pull/1523) + ([janmasrovira](https://github.com/janmasrovira)) +- Refactor `destruct` in Core/Extra/Base + [#1522](https://github.com/anoma/juvix/pull/1522) + ([lukaszcz](https://github.com/lukaszcz)) +- JuvixCore primitive types + [#1521](https://github.com/anoma/juvix/pull/1521) + ([lukaszcz](https://github.com/lukaszcz)) +- Enable autocompletion for the –theme flag + [#1519](https://github.com/anoma/juvix/pull/1519) + ([janmasrovira](https://github.com/janmasrovira)) +- Stripped version of Core Node datatype + [#1518](https://github.com/anoma/juvix/pull/1518) + ([lukaszcz](https://github.com/lukaszcz)) +- Add `internal core read` command + [#1517](https://github.com/anoma/juvix/pull/1517) + ([janmasrovira](https://github.com/janmasrovira)) +- Implement some instances for BinderList + [#1515](https://github.com/anoma/juvix/pull/1515) + ([janmasrovira](https://github.com/janmasrovira)) +- Back recursor types with type families + [#1514](https://github.com/anoma/juvix/pull/1514) + ([janmasrovira](https://github.com/janmasrovira)) +- Eager evaluation of Constr arguments + [#1513](https://github.com/anoma/juvix/pull/1513) + ([lukaszcz](https://github.com/lukaszcz)) +- Dynamic type in Core + [#1508](https://github.com/anoma/juvix/pull/1508) + ([lukaszcz](https://github.com/lukaszcz)) +- LetRec in Core [#1507](https://github.com/anoma/juvix/pull/1507) + ([lukaszcz](https://github.com/lukaszcz)) +- Add Haddock and Agda licenses + [#1506](https://github.com/anoma/juvix/pull/1506) + ([janmasrovira](https://github.com/janmasrovira)) +- Fix docs webapp examples CI build + [#1505](https://github.com/anoma/juvix/pull/1505) + ([paulcadman](https://github.com/paulcadman)) +- Add CLI usage examples doc and integrate with README + [#1504](https://github.com/anoma/juvix/pull/1504) + ([paulcadman](https://github.com/paulcadman)) +- Refactor BinderInfo + [#1503](https://github.com/anoma/juvix/pull/1503) + ([lukaszcz](https://github.com/lukaszcz)) +- Make `juvix compile` default to native target + [#1502](https://github.com/anoma/juvix/pull/1502) + ([paulcadman](https://github.com/paulcadman)) +- Refactor Node datatype + [#1501](https://github.com/anoma/juvix/pull/1501) + ([lukaszcz](https://github.com/lukaszcz)) +- Clean up import list in Pipeline + [#1499](https://github.com/anoma/juvix/pull/1499) + ([jonaprieto](https://github.com/jonaprieto)) +- Remove mono [#1497](https://github.com/anoma/juvix/pull/1497) + ([jonaprieto](https://github.com/jonaprieto)) +- Remove Haskell support + [#1496](https://github.com/anoma/juvix/pull/1496) + ([jonaprieto](https://github.com/jonaprieto)) +- Implement lambda lifting + [#1494](https://github.com/anoma/juvix/pull/1494) + ([janmasrovira](https://github.com/janmasrovira)) +- Document Emacs installation and the 'exec-path' problem + [#1493](https://github.com/anoma/juvix/pull/1493) + ([lukaszcz](https://github.com/lukaszcz)) +- Add –allow-different-user to workflow stack command + [#1492](https://github.com/anoma/juvix/pull/1492) + ([paulcadman](https://github.com/paulcadman)) +- Stack with github actions permissions workaround + [#1490](https://github.com/anoma/juvix/pull/1490) + ([paulcadman](https://github.com/paulcadman)) +- Restructure recursors and add some lens interfaces + [#1489](https://github.com/anoma/juvix/pull/1489) + ([janmasrovira](https://github.com/janmasrovira)) +- Add a github action to build a static linux binary + [#1488](https://github.com/anoma/juvix/pull/1488) + ([paulcadman](https://github.com/paulcadman)) +- Fix developBeta in Core/Extra.hs + [#1487](https://github.com/anoma/juvix/pull/1487) + ([lukaszcz](https://github.com/lukaszcz)) +- Add an option to show name ids in errors + [#1486](https://github.com/anoma/juvix/pull/1486) + ([lukaszcz](https://github.com/lukaszcz)) + +## [v0.2.4](https://github.com/anoma/juvix/tree/v0.2.4) (2022-08-19) + +[Full Changelog](https://github.com/anoma/juvix/compare/v0.2.3...v0.2.4) + +(Special version for Heliax's retreat in Italy) + +**Implemented enhancements:** + +- Add –stdin flag [#1459](https://github.com/anoma/juvix/pull/1459) + ([janmasrovira](https://github.com/janmasrovira)) + +**Fixed bugs:** + +- Fix typechecker [#1458](https://github.com/anoma/juvix/pull/1458) + ([janmasrovira](https://github.com/janmasrovira)) + +**Merged pull requests:** + +- use –stdin in flycheck mode + [#1460](https://github.com/anoma/juvix/pull/1460) + ([janmasrovira](https://github.com/janmasrovira)) +- Add a native compile target for demos + [#1457](https://github.com/anoma/juvix/pull/1457) + ([paulcadman](https://github.com/paulcadman)) +- Small changes for the presentation + [#1456](https://github.com/anoma/juvix/pull/1456) + ([jonaprieto](https://github.com/jonaprieto)) +- Fixes TicTacToe Web example + [#1454](https://github.com/anoma/juvix/pull/1454) + ([paulcadman](https://github.com/paulcadman)) +- Upgrade to ghc-9.2.4 + [#1451](https://github.com/anoma/juvix/pull/1451) + ([janmasrovira](https://github.com/janmasrovira)) + +## [v0.2.3](https://github.com/anoma/juvix/tree/v0.2.3) (2022-08-15) + +[Full Changelog](https://github.com/anoma/juvix/compare/v0.2.2...v0.2.3) + +**Implemented enhancements:** + +- add `name` and `version` to `juvix.yaml` + [#1422](https://github.com/anoma/juvix/pull/1422) + ([janmasrovira](https://github.com/janmasrovira)) + +**Fixed bugs:** + +- Properly handle paragraphs in judoc + [#1447](https://github.com/anoma/juvix/pull/1447) + ([janmasrovira](https://github.com/janmasrovira)) + +**Merged pull requests:** + +- Give a proper type to literal natural numbers + [#1453](https://github.com/anoma/juvix/pull/1453) + ([janmasrovira](https://github.com/janmasrovira)) +- Add the option to output json in the `juvix internal highlight` + command [#1450](https://github.com/anoma/juvix/pull/1450) + ([janmasrovira](https://github.com/janmasrovira)) for supporting the + new Juvix Mode for Visual Studio Code + ([jonaprieto](https://github.com/anoma/vscode-juvix)) +- Allow \_ in Wasm exported names to support Anoma signature + [#1449](https://github.com/anoma/juvix/pull/1449) + ([paulcadman](https://github.com/paulcadman)) +- Add Towers of Hanoi and Pascal triangle examples + [#1446](https://github.com/anoma/juvix/pull/1446) + ([paulcadman](https://github.com/paulcadman)) +- Add `juvix init` command + [#1445](https://github.com/anoma/juvix/pull/1445) + ([janmasrovira](https://github.com/janmasrovira)) +- Refactor pretty to reduce duplication + [#1443](https://github.com/anoma/juvix/pull/1443) + ([janmasrovira](https://github.com/janmasrovira)) +- Add initial support for examples in Html documentation + [#1442](https://github.com/anoma/juvix/pull/1442) + ([janmasrovira](https://github.com/janmasrovira)) +- Add revisions to README + [#1440](https://github.com/anoma/juvix/pull/1440) + ([jonaprieto](https://github.com/jonaprieto)) +- CI: Run build on push to main + [#1437](https://github.com/anoma/juvix/pull/1437) + ([paulcadman](https://github.com/paulcadman)) +- Add doctor subcommand + [#1436](https://github.com/anoma/juvix/pull/1436) + ([paulcadman](https://github.com/paulcadman)) +- CI checkout repo before cache and use recommended cache strategy + [#1435](https://github.com/anoma/juvix/pull/1435) + ([paulcadman](https://github.com/paulcadman)) +- Various documentation adjustments + [#1434](https://github.com/anoma/juvix/pull/1434) + ([paulcadman](https://github.com/paulcadman)) +- Setup Clang before building docs in CI + [#1433](https://github.com/anoma/juvix/pull/1433) + ([paulcadman](https://github.com/paulcadman)) +- Major revisions to Makefile + [#1431](https://github.com/anoma/juvix/pull/1431) + ([jonaprieto](https://github.com/jonaprieto)) +- Do not add `-src` suffix to links in HTML when running `juvix html` + [#1429](https://github.com/anoma/juvix/pull/1429) + ([paulcadman](https://github.com/paulcadman)) +- Add a Web version of TicTacToe + [#1427](https://github.com/anoma/juvix/pull/1427) + ([paulcadman](https://github.com/paulcadman)) +- WASM import all non-compile axioms with alphanum names in entrypoint + [#1426](https://github.com/anoma/juvix/pull/1426) + ([paulcadman](https://github.com/paulcadman)) +- Export all functions with alpha numeric names from entrypoint module + [#1425](https://github.com/anoma/juvix/pull/1425) + ([paulcadman](https://github.com/paulcadman)) +- Refactor [#1420](https://github.com/anoma/juvix/pull/1420) + ([jonaprieto](https://github.com/jonaprieto)) +- Permit axiom without a compile block + [#1418](https://github.com/anoma/juvix/pull/1418) + ([paulcadman](https://github.com/paulcadman)) +- Implement an html documentation generator similar to haddock (#1413) + [#1416](https://github.com/anoma/juvix/pull/1416) + ([janmasrovira](https://github.com/janmasrovira)) +- Fix version shell test for 0.2.2 + [#1415](https://github.com/anoma/juvix/pull/1415) + ([paulcadman](https://github.com/paulcadman)) +- Remove Int from stdlib and update SimpleFungibleToken example + [#1414](https://github.com/anoma/juvix/pull/1414) + ([paulcadman](https://github.com/paulcadman)) + +## [v0.2.2](https://github.com/anoma/juvix/tree/v0.2.2) (2022-07-25) + +[Full Changelog](https://github.com/anoma/juvix/compare/v0.2.1...v0.2.2) + +**Implemented enhancements:** + +- Compute name dependency graph and filter unreachable definitions + [#1408](https://github.com/anoma/juvix/pull/1408) + ([lukaszcz](https://github.com/lukaszcz)) +- Support type aliases + [#1404](https://github.com/anoma/juvix/pull/1404) + ([janmasrovira](https://github.com/janmasrovira)) +- Add debugging custom function to Prelude + [#1401](https://github.com/anoma/juvix/pull/1401) + ([jonaprieto](https://github.com/jonaprieto)) +- Add positivity check for data types + [#1393](https://github.com/anoma/juvix/pull/1393) + ([jonaprieto](https://github.com/jonaprieto)) +- Keep qualified names + [#1392](https://github.com/anoma/juvix/pull/1392) + ([janmasrovira](https://github.com/janmasrovira)) +- Direct translation from MicroJuvix to MiniC + [#1386](https://github.com/anoma/juvix/pull/1386) + ([lukaszcz](https://github.com/lukaszcz)) +- Widens the accepted symbol list + [#1385](https://github.com/anoma/juvix/pull/1385) + ([mariari](https://github.com/mariari)) +- Check all the type parameter names are different when declaring an + inductive type [#1377](https://github.com/anoma/juvix/pull/1377) + ([jonaprieto](https://github.com/jonaprieto)) + +**Fixed bugs:** + +- Curly braces are allowed nested in patterns + [#1380](https://github.com/anoma/juvix/pull/1380) + ([janmasrovira](https://github.com/janmasrovira)) + +**Merged pull requests:** + +- Add `Fail` effect (#1409) + [#1411](https://github.com/anoma/juvix/pull/1411) + ([janmasrovira](https://github.com/janmasrovira)) +- Refactor of typechecking and other checking processes + [#1410](https://github.com/anoma/juvix/pull/1410) + ([jonaprieto](https://github.com/jonaprieto)) +- Use bold for code in scoper error messages + [#1403](https://github.com/anoma/juvix/pull/1403) + ([janmasrovira](https://github.com/janmasrovira)) +- Replace ppSimple by text + [#1402](https://github.com/anoma/juvix/pull/1402) + ([jonaprieto](https://github.com/jonaprieto)) +- Implement some error messages (#1396) + [#1400](https://github.com/anoma/juvix/pull/1400) + ([lukaszcz](https://github.com/lukaszcz)) +- Refactor childs of pattern parentheses and braces + [#1398](https://github.com/anoma/juvix/pull/1398) + ([janmasrovira](https://github.com/janmasrovira)) +- Update Juvix standard-library + [#1389](https://github.com/anoma/juvix/pull/1389) + ([jonaprieto](https://github.com/jonaprieto)) +- Fix documentation generation + [#1387](https://github.com/anoma/juvix/pull/1387) + ([jonaprieto](https://github.com/jonaprieto)) +- Adds Collatz sequence generator example + [#1384](https://github.com/anoma/juvix/pull/1384) + ([paulcadman](https://github.com/paulcadman)) +- html-examples [#1381](https://github.com/anoma/juvix/pull/1381) + ([jonaprieto](https://github.com/jonaprieto)) +- Refine hole in type signature to function type + [#1379](https://github.com/anoma/juvix/pull/1379) + ([janmasrovira](https://github.com/janmasrovira)) +- Type checking fails when the type of a pattern is not given by the + signature [#1378](https://github.com/anoma/juvix/pull/1378) + ([janmasrovira](https://github.com/janmasrovira)) +- Set cname for gh-pages action + [#1376](https://github.com/anoma/juvix/pull/1376) + ([paulcadman](https://github.com/paulcadman)) +- Add fibonacci sequence example program + [#1375](https://github.com/anoma/juvix/pull/1375) + ([paulcadman](https://github.com/paulcadman)) +- Fix Changelog links and minors + [#1371](https://github.com/anoma/juvix/pull/1371) + ([jonaprieto](https://github.com/jonaprieto)) +- Add Version number to the emacs mode + [#1320](https://github.com/anoma/juvix/pull/1320) + ([mariari](https://github.com/mariari)) + +## New name: Juvix + +Since version 0.2.2, the project has been renamed from "Mini Juvix" to +"Juvix". The new name reflects the fact that the project is no longer +just a compiler for a subset of Juvix, but a full implementation of the +language. Affected by this change are: + +- Github repository moved from the Heliax organization to the Anoma + organization. "anoma/juvix" is the new repository name. +- All references to "Mini Juvix" have been replaced with "Juvix". + Unfortunetly, + +due to the move, the old links to the Mini Juvix repository are broken +and will not be fixed. + +## v0.2.1 (2022-07-12) + +**Implemented enhancements:** + +- Specialize commands of/for internal use MiniJuvix-#270 + ([jonaprieto](https://github.com/jonaprieto)) +- Improve handling of location information for different objs + MiniJuvix-#263 ([jonaprieto](https://github.com/jonaprieto)) +- Add issues and PR templates MiniJuvix-#261 + ([jonaprieto](https://github.com/jonaprieto)) +- Throw error when reading a file that conflicts with embedded stdlib + MiniJuvix-#243 ([paulcadman](https://github.com/paulcadman)) +- Embed standard library in the minijuvix binary MiniJuvix-#210 + ([paulcadman](https://github.com/paulcadman)) + +**Fixed bugs:** + +- Fixed a bug with the path to walloc.c MiniJuvix-#237 + ([lukaszcz](https://github.com/lukaszcz)) +- Perform ScopedToAbstract exactly once for each module MiniJuvix-#223 + ([paulcadman](https://github.com/paulcadman)) + +**Merged pull requests:** + +- Label renaming MiniJuvix-#275 + ([jonaprieto](https://github.com/jonaprieto)) +- Update link to discord MiniJuvix-#264 + ([Romainua](https://github.com/Romainua)) +- Include `open import` statements when generating HTML MiniJuvix-#260 + ([paulcadman](https://github.com/paulcadman)) +- Renaming MiniJuvix to Juvix MiniJuvix-#259 + ([jonaprieto](https://github.com/jonaprieto)) +- Updates tests to use the updated standard library MiniJuvix-#253 + ([paulcadman](https://github.com/paulcadman)) +- Enforce C99 standard in the generated C files MiniJuvix-#252 + ([lukaszcz](https://github.com/lukaszcz)) +- Restore mascot images to the minijuvix book MiniJuvix-#250 + ([paulcadman](https://github.com/paulcadman)) +- Allow jumping to another module in emacs MiniJuvix-#249 + ([janmasrovira](https://github.com/janmasrovira)) +- Restore Juvix mascot image to README MiniJuvix-#248 + ([paulcadman](https://github.com/paulcadman)) +- Add emacs option `minijuvix-disable-embedded-stdlib` MiniJuvix-#247 + ([paulcadman](https://github.com/paulcadman)) +- Deprecate GHC backend MiniJuvix-#244 + ([lukaszcz](https://github.com/lukaszcz)) +- Removed 'eval' and 'print' keywords (#214) MiniJuvix-#242 + ([lukaszcz](https://github.com/lukaszcz)) +- Add option to disable minijuvix input method MiniJuvix-#239 + ([janmasrovira](https://github.com/janmasrovira)) +- Remove the 'match' keyword MiniJuvix-#238 + ([lukaszcz](https://github.com/lukaszcz)) +- Removed tests/positive/HelloWorld.mjuvix and specified clang version + in the documentation MiniJuvix-#236 + ([lukaszcz](https://github.com/lukaszcz)) +- Filter symbol entries properly in the scoper MiniJuvix-#234 + ([janmasrovira](https://github.com/janmasrovira)) +- Use the ModulesCache for `open` statements in ScopedToAbstract pass + MiniJuvix-#224 ([paulcadman](https://github.com/paulcadman)) +- README: Include `--recursive` in git clone command to fetch stdlib + MiniJuvix-#211 ([paulcadman](https://github.com/paulcadman)) +- Update project description v0.2.0 MiniJuvix-#209 + ([jonaprieto](https://github.com/jonaprieto)) +- Unify AST representation of types and expressions in MicroJuvix + MiniJuvix-#188 ([janmasrovira](https://github.com/janmasrovira)) + +## v0.2.0 (2022-06-28) + +**Implemented enhancements:** + +- Support built in types MiniJuvix-#192 + ([janmasrovira](https://github.com/janmasrovira)) +- Support partial application and closure passing in C backend + MiniJuvix-#190 ([paulcadman](https://github.com/paulcadman)) +- Allow `open import` statements MiniJuvix-#175 + ([janmasrovira](https://github.com/janmasrovira)) +- Remove TypeAny and adapt typechecking for literals MiniJuvix-#173 + ([janmasrovira](https://github.com/janmasrovira)) +- Allow holes to be refined into function types MiniJuvix-#165 + ([janmasrovira](https://github.com/janmasrovira)) +- Support implicit arguments MiniJuvix-#144 + ([janmasrovira](https://github.com/janmasrovira)) +- Add support for holes in type signatures MiniJuvix-#141 + ([janmasrovira](https://github.com/janmasrovira)) +- Support function closures with no environment in minic + MiniJuvix-#137 ([paulcadman](https://github.com/paulcadman)) +- Add holes for expressions in function clauses and inference support + MiniJuvix-#136 ([janmasrovira](https://github.com/janmasrovira)) +- Add "-Oz" optimization flag to clang args MiniJuvix-#133 + ([paulcadman](https://github.com/paulcadman)) +- Add version and help option and root command to the CLI + MiniJuvix-#131 ([jonaprieto](https://github.com/jonaprieto)) + +**Fixed bugs:** + +- Fix: Ignore implicit patterns and arguments in termination checking + MiniJuvix-#172 ([janmasrovira](https://github.com/janmasrovira)) +- Fix: pretty printing for terminating keyword MiniJuvix-#145 + ([jonaprieto](https://github.com/jonaprieto)) + +**Merged pull requests:** + +- Fix: proper error handling for typechecker errors MiniJuvix-#189 + ([jonaprieto](https://github.com/jonaprieto)) +- Add juvix version info and date to HTML output MiniJuvix-#186 + ([jonaprieto](https://github.com/jonaprieto)) +- Fix: Add check for constructor return types MiniJuvix-#182 + ([jonaprieto](https://github.com/jonaprieto)) +- Use Abstract name in Abstract syntax and Micro/MonoJuvix + MiniJuvix-#181 ([janmasrovira](https://github.com/janmasrovira)) +- Add an option to specify the path where to put the HTML output + MiniJuvix-#179 ([jonaprieto](https://github.com/jonaprieto)) +- Upgrade to ghc-9.2.3 MiniJuvix-#178 + ([janmasrovira](https://github.com/janmasrovira)) +- Replace dead link in README with a link to the Juvix book + MiniJuvix-#177 ([paulcadman](https://github.com/paulcadman)) +- Embed HTML assets in the juvix binary MiniJuvix-#176 + ([paulcadman](https://github.com/paulcadman)) +- Fix: identifiers with a keyword prefix cannot be parsed + MiniJuvix-#171 ([janmasrovira](https://github.com/janmasrovira)) +- Improve filepath equality MiniJuvix-#170 + ([janmasrovira](https://github.com/janmasrovira)) +- Update validity predicate milestone example to 0.2 syntax + MiniJuvix-#167 ([paulcadman](https://github.com/paulcadman)) +- Fix links in documentation and update to new syntax MiniJuvix-#163 + ([paulcadman](https://github.com/paulcadman)) +- Update stdlib to work with version 0.2 MiniJuvix-#160 + ([janmasrovira](https://github.com/janmasrovira)) +- Update README usage example to use the compile command + MiniJuvix-#158 ([paulcadman](https://github.com/paulcadman)) +- Remove dead code related to the pipeline MiniJuvix-#156 + ([janmasrovira](https://github.com/janmasrovira)) +- Add negative test for AppLeftImplicit MiniJuvix-#154 + ([janmasrovira](https://github.com/janmasrovira)) +- Add positive test designed for implicit arguments MiniJuvix-#153 + ([janmasrovira](https://github.com/janmasrovira)) +- Remove ExpressionTyped from MicroJuvix MiniJuvix-#143 + ([janmasrovira](https://github.com/janmasrovira)) +- Revision for package.yaml and minor deletions MiniJuvix-#135 + ([jonaprieto](https://github.com/jonaprieto)) + +## v0.1.4 (2022-05-30) + +**Merged pull requests:** + +- Generic Errors and refactoring MiniJuvix-#123 + ([jonaprieto](https://github.com/jonaprieto)) +- Only generates docs if the pull request merges MiniJuvix-#121 + ([jonaprieto](https://github.com/jonaprieto)) +- Add initial docs generation website MiniJuvix-#119 + ([jonaprieto](https://github.com/jonaprieto)) +- Fix internal link in README MiniJuvix-#116 + ([paulcadman](https://github.com/paulcadman)) +- Add minic-runtime for linking without libc MiniJuvix-#113 + ([paulcadman](https://github.com/paulcadman)) +- Add termination checking to the pipeline MiniJuvix-#111 + ([jonaprieto](https://github.com/jonaprieto)) +- Support uncurried higher order functions MiniJuvix-#110 + ([paulcadman](https://github.com/paulcadman)) +- Improve error generation and handling MiniJuvix-#108 + ([janmasrovira](https://github.com/janmasrovira)) +- Add MiniC tests with clang+wasi-sdk MiniJuvix-#105 + ([paulcadman](https://github.com/paulcadman)) +- Add usage example and move developer docs MiniJuvix-#96 + ([paulcadman](https://github.com/paulcadman)) +- Refactor warning related stuff MiniJuvix-#91 + ([janmasrovira](https://github.com/janmasrovira)) +- Remove Agda backend MiniJuvix-#86 + ([paulcadman](https://github.com/paulcadman)) + +**Implemented enhancements:** + +- Add `compile` subcommand to generate binaries MiniJuvix-#128 +- Add intervals to flycheck errors MiniJuvix-#124 +- Improve error handling in juvix-mode MiniJuvix-#107 +- Support multiple modules in compilation MiniJuvix-#93 +- Add compile command to CLI MiniJuvix-#130 + ([paulcadman](https://github.com/paulcadman)) +- Use Interval in GenericErrors MiniJuvix-#125 + ([janmasrovira](https://github.com/janmasrovira)) +- Remove dev in the CI and other tweaks MiniJuvix-#118 + ([jonaprieto](https://github.com/jonaprieto)) +- Highlight comments correctly MiniJuvix-#106 + ([janmasrovira](https://github.com/janmasrovira)) +- Support multiple modules in compilation MiniJuvix-#100 + ([janmasrovira](https://github.com/janmasrovira)) +- New target syntax and modular VP examples MiniJuvix-#92 + ([jonaprieto](https://github.com/jonaprieto)) + +**Fixed bugs:** + +- Missing error messages when using throw/error MiniJuvix-#117 +- Fix highlight of comments MiniJuvix-#104 +- Fix juvix-mode coloring for projects with multiple modules + MiniJuvix-#101 +- Fix `highlight` command for modules with import statements + MiniJuvix-#102 ([janmasrovira](https://github.com/janmasrovira)) + +**Closed issues:** + +- Deprecate the class JuvixError MiniJuvix-#115 +- Add ToGenericError instance for the infix parsing errors + MiniJuvix-#114 +- Compile to WASM without linking libc MiniJuvix-#112 +- Add the termination checker to the pipeline MiniJuvix-#109 +- Use clang + wasi-sdk instead of emcc to compile to WASM + MiniJuvix-#103 +- Move developer tooling docs out of README MiniJuvix-#95 +- Add pre-commit checks to CI checks MiniJuvix-#94 +- Support higher order functions in C backend MiniJuvix-#90 +- Remove dev from the list of branches in the CI MiniJuvix-#89 +- Refactor warning related stuff MiniJuvix-#87 +- The Juvix website MiniJuvix-#51 + +## v0.1.3 (2022-05-05) + +**Closed issues:** + +- Monomorphisation naming inconsistency MiniJuvix-#84 +- Remove BackendAgda MiniJuvix-#83 +- Change terminating keyword behavior MiniJuvix-#81 +- MonoJuvix `ExpressionTyped` is never used MiniJuvix-#79 +- Bump stackage nightly and delete `allow-newer: true` from + `stack.yaml` MiniJuvix-#75 +- Generate automatically CHANGELOG and Github Release Notes + MiniJuvix-#73 +- Make flag –show-name-ids global MiniJuvix-#61 +- Add C code generation backend MiniJuvix-#60 +- Add polymorphism MiniJuvix-#59 +- Add the compile keyword to the frontend syntax (support up to + Scoping) MiniJuvix-#58 +- Error with undefined or underscores MiniJuvix-#54 +- Add support for other GHC and Stack stable version MiniJuvix-#52 +- Autodetect output ANSI support when prettyprinting MiniJuvix-#38 +- Terminating for type signatures MiniJuvix-#11 + +**Merged pull requests:** + +- Remove agda backend MiniJuvix-#86 + ([paulcadman](https://github.com/paulcadman)) +- 84 monomorphisation naming inconsistency MiniJuvix-#85 + ([janmasrovira](https://github.com/janmasrovira)) +- Change terminating keyword behavior MiniJuvix-#82 + ([jonaprieto](https://github.com/jonaprieto)) +- Remove unused constructor ExpressionTyped in Monojuvix MiniJuvix-#80 + ([janmasrovira](https://github.com/janmasrovira)) +- Stricter stack builds and pedantic mode for CI MiniJuvix-#78 + ([jonaprieto](https://github.com/jonaprieto)) +- Bump stackage version and remove allow-newer MiniJuvix-#76 + ([janmasrovira](https://github.com/janmasrovira)) +- Add automatically updates/issues/merged PRs to the changelog + MiniJuvix-#74 ([jonaprieto](https://github.com/jonaprieto)) +- Add terminating keyword MiniJuvix-#71 + ([jonaprieto](https://github.com/jonaprieto)) +- Monomorphization MiniJuvix-#70 + ([janmasrovira](https://github.com/janmasrovira)) +- Remove StatementCompile in AST after scoping MiniJuvix-#69 + ([paulcadman](https://github.com/paulcadman)) +- Add C code generation backend MiniJuvix-#68 + ([paulcadman](https://github.com/paulcadman)) +- Check if stderr supports ANSI and print accordingly MiniJuvix-#67 + ([janmasrovira](https://github.com/janmasrovira)) +- Add support for compile (by Jonathan) MiniJuvix-#66 + ([paulcadman](https://github.com/paulcadman)) +- Add NameIdGen effect to the pipeline MiniJuvix-#64 + ([janmasrovira](https://github.com/janmasrovira)) +- Make the `--show-name-ids` flag global MiniJuvix-#63 + ([janmasrovira](https://github.com/janmasrovira)) +- Implement type checker with polymorphism MiniJuvix-#62 + ([janmasrovira](https://github.com/janmasrovira)) + +## v0.1.2 (2022-04-11) + +**Closed issues:** + +- Add en emacs mode with support for scoped highlighting MiniJuvix-#25 +- Add support for project root detection through a juvix.yaml file + MiniJuvix-#24 +- Add CLI cmd to generate juvix autocompletion files for fish and zsh + MiniJuvix-#23 +- Add pretty and typecheck subcommands to the microjuvix CLI + MiniJuvix-#21 +- Translate identifiers from MicroJuvix to MiniHaskell (valid Haskell) + MiniJuvix-#19 +- Implement the MiniHaskell to Haskell translation (prettyprinter) + MiniJuvix-#18 +- Implementation of a typechecker for MicroJuvix MiniJuvix-#16 +- Add references to the Abstract AST to update compilation to + MiniHaskell MiniJuvix-#12 +- Order in the house MiniJuvix-#10 + +**Merged pull requests:** + +- The Juvix project now follows the same goals as the original Juvix + project. MiniJuvix-#7 ([jonaprieto](https://github.com/jonaprieto)) +- Dev→main MiniJuvix-#6 ([jonaprieto](https://github.com/jonaprieto)) +- Big update including termination checking MiniJuvix-#5 + ([janmasrovira](https://github.com/janmasrovira)) +- Parser and scoper MiniJuvix-#3 + ([jonaprieto](https://github.com/jonaprieto)) +- Upgrade to ghc9 and use hpack MiniJuvix-#2 + ([janmasrovira](https://github.com/janmasrovira)) +- Merge MiniJuvix-#1 ([jonaprieto](https://github.com/jonaprieto)) + +## v0.1.1 (2022-03-25) + +- Add support in the parser/scoper for Axiom backends +- Add support for `foreign` keyword +- Add flag `--no-colors` for the scope command +- Upgrade to GHC 9.2.2 +- Improve resolution of local symbols in the scoper +- Several new tests related to ambiguous symbols +- Add `--version` flag +- Add InfoTableBuilder effect for the scoper + +**Closed issues:** + +- Add diff output to the test suite MiniJuvix-#9 +- Improve scoper ambiguity error messages MiniJuvix-#8 diff --git a/docs/examples/README.md b/docs/examples/README.md new file mode 100644 index 000000000..da14b91da --- /dev/null +++ b/docs/examples/README.md @@ -0,0 +1,15 @@ +## [Examples of programs written in Juvix](https://github.com/anoma/juvix/tree/main/examples/milestone) + +The following links are clickable versions of their corresponding Juvix +programs. The HTML output can be generated by running +`juvix html --recursive FileName.juvix`. + +- [HelloWorld.juvix](https://docs.juvix.org/examples/html/HelloWorld/HelloWorld.html) +- [Fibonacci.juvix](https://docs.juvix.org/examples/html/Fibonacci/Fibonacci.html) +- [Hanoi.juvix](https://docs.juvix.org/examples/html/Hanoi/Hanoi.html) +- [PascalsTriangle.juvix](https://docs.juvix.org/examples/html/PascalsTriangle/PascalsTriangle.html) +- [Collatz.juvix](https://docs.juvix.org/examples/html/Collatz/Collatz.html) +- [TicTacToe.juvix](https://docs.juvix.org/examples/html/TicTacToe/CLI/CLI.TicTacToe.html) + +The [Juvix standard library](https://anoma.github.io/juvix-stdlib/) +contains common functions that can be used in Juvix programs. diff --git a/docs/explanations/totality/README.md b/docs/explanations/totality/README.md new file mode 100644 index 000000000..d68a6db08 --- /dev/null +++ b/docs/explanations/totality/README.md @@ -0,0 +1 @@ +# Totality checking diff --git a/docs/explanations/totality/coverage.md b/docs/explanations/totality/coverage.md new file mode 100644 index 000000000..ba2cdb89b --- /dev/null +++ b/docs/explanations/totality/coverage.md @@ -0,0 +1 @@ +# Coverage checking diff --git a/docs/explanations/totality/positive.md b/docs/explanations/totality/positive.md new file mode 100644 index 000000000..ca0db59f7 --- /dev/null +++ b/docs/explanations/totality/positive.md @@ -0,0 +1 @@ +# Strictly positive data types diff --git a/docs/explanations/totality/termination.md b/docs/explanations/totality/termination.md new file mode 100644 index 000000000..2d9fb9457 --- /dev/null +++ b/docs/explanations/totality/termination.md @@ -0,0 +1,29 @@ +# Termination + +To not bring inconsistencies by function declarations, Juvix requires +that every function passes its termination checker. However, since this +is a strong requirement, often tricky to fulfil, we give the user the +possibility to skip this check in two different ways: + +- Using the `terminating` keyword to annotate function type signatures + as terminating. The syntax is the following. + +```juvix +terminating fun : A → B; +``` + +Note that annotating a function as `terminating` means that _all_ its +function clauses pass the termination checker's criterion. To skip the +termination checker for mutual recursive functions, all the functions +involved must be annotated as `terminating`. + +- Using the CLI global flag `--no-termination`. + +```juvix +juvix typecheck --no-termination MyProgram.juvix +``` + +In any case, be aware that our termination checker is limited as it only +accepts a subset of recursion functions. The termination checker +algorithm is a slight modification of the algorithm for checking +termination in the Foetus's language. diff --git a/docs/explanations/typetheory.md b/docs/explanations/typetheory.md new file mode 100644 index 000000000..4fdafc3f4 --- /dev/null +++ b/docs/explanations/typetheory.md @@ -0,0 +1 @@ +# Type theory diff --git a/docs/howto/compilation.md b/docs/howto/compilation.md new file mode 100644 index 000000000..ed5e3ec50 --- /dev/null +++ b/docs/howto/compilation.md @@ -0,0 +1,51 @@ +# Compiling simple programs + +A Juvix file must declare a module whose name corresponds exactly to the +name of the file. For example, a file `Hello.juvix` must declare a +module `Hello`: + +```juvix +-- Hello world example. This is a comment. +module Hello; + +-- Import the standard library prelude, including the function 'printStringLn' +open import Stdlib.Prelude; + +main : IO; +main := printStringLn "Hello world!"; + +end; +``` + +A file compiled to an executable must define the zero-argument function +`main` of type `IO` which is evaluated when running the program. + +To compile the file `Hello.juvix` type `juvix compile Hello.juvix`. +Typing `juvix compile --help` will list all options to the `compile` +command. + +# Compilation targets + +Since version 0.3 Juvix supports three compilation targets. The targets +are specified with the `-t` option: +`juvix compile -t target file.juvix`. + +1. `native`. This is the default. Produces a native 64bit executable + for your machine. +2. `wasm32-wasi`. Produces a WebAssembly binary which uses the WASI + runtime. +3. `geb`. Produces a [GEB](https://anoma.github.io/geb/) input file. + +# Juvix projects + +A Juvix project is a collection of Juvix modules inside one main +project directory containing a `juvix.yaml` metadata file. The name of +each module must coincide with the path of the file it is defined in, +relative to the project's root directory. For example, if the file is +`root/Data/List.juvix` then the module must be called `Data.List`, +assuming `root` is the project's directory. + +To check that Juvix is correctly detecting your project's root, you can +run the command `juvix dev root File.juvix`. + +See also: [Modules Reference](../reference/language/modules.md). diff --git a/docs/howto/installing.md b/docs/howto/installing.md new file mode 100644 index 000000000..5bc44a9a7 --- /dev/null +++ b/docs/howto/installing.md @@ -0,0 +1,135 @@ +# Dependencies + +You need [Clang / LLVM](https://releases.llvm.org/download.html) version +13 or later. Note that on macOS the preinstalled clang does not support +the wasm target, so use e.g. `brew install llvm` instead. + +If you want to compile to WebAssembly, you also need: + +- [wasmer](https://wasmer.io) +- [wasi-sdk](https://github.com/WebAssembly/wasi-sdk/releases) +- [wasm-ld](https://lld.llvm.org) - the LLVM linker for WASM (NB: On + Linux you may need to install the `lld` package; on macOS this is + installed as part of `llvm`). + +See [below](./installing.md#installing-dependencies) for instructions on +how to install the dependencies. + +# Installing Juvix + +### MacOS + +The easiest way to install Juvix on MacOS is by using +[Homebrew](https://brew.sh). + +To install the [homebrew-juvix +tap](https://github.com/anoma/homebrew-juvix), run: + +```shell +brew tap anoma/juvix +``` + +To install Juvix, run: + +```shell +brew install juvix +``` + +Helpful information can also be obtained by running: + +```shell +brew info juvix +``` + +### Linux x8664 + +A Juvix compiler binary executable for Linux x8664 is +available on the [Juvix release +page](https://github.com/anoma/juvix/releases/latest). + +To install this executable, download and unzip the linked file and move +it to a directory on your shell's `PATH`. + +For example if `~/.local/bin` is on your shell's `PATH`, you can install +Juvix as follows: + +```shell +cd /tmp +curl -OL https://github.com/anoma/juvix/releases/download/v0.3.0/juvix-linux_x86_64-v0.3.0.zip +unzip juvix-linux_x86_64-v0.3.0.zip +mv juvix-linux_x86_64-v0.3.0 ~/.local/bin/juvix +``` + +### Building Juvix from source + +To install Juvix from source you must clone the [Github +repository](https://github.com/anoma/juvix.git). Then Juvix can be +installed with the following commands. We assume you have +[Stack](https://haskellstack.org) and [GNU +Make](https://www.gnu.org/software/make/) installed. + +```shell +git clone --recursive https://github.com/anoma/juvix.git +cd juvix +make install +``` + +The C compiler and linker paths can be specified as options to the +`make install` command, e.g. + +```shell +make install CC=path/to/clang LIBTOOL=path/to/llvm-ar +``` + +On MacOS, you can alternatively run the following command for Homebrew. +The flag `--HEAD` used below is optional – use it to build the latest +version of Juvix in the `main` branch on Github. + +```shell +brew install --build-from-source --HEAD juvix --verbose +``` + +### Building the project with `cabal` + +We recommend to use the `stack` build tool with this project. + +If you prefer the `cabal` build tool instead, then you need to generate +the `juvix.cabal` file using [hpack](https://github.com/sol/hpack) +before running `cabal build`. + +You also need to compile the runtime first: + +```shell +make runtime +cabal build +``` + +# Installing dependencies + +To install `wasi-sdk` you need to download `libclang_rt` and +`wasi-sysroot` precompiled archives from the [wasi-sdk release +page](https://github.com/WebAssembly/wasi-sdk/releases/) and: + +1. Extract the `libclang_rt.builtins-wasm32-wasi-*.tar.gz` archive in + the `clang` installation root (for example `/usr/lib/clang/13` on + Ubuntu or `` `brew --prefix llvm` `` on macos). + + For example on macos with homebrew clang: + + ```shell + cd `brew --prefix llvm` + curl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-15/libclang_rt.builtins-wasm32-wasi-15.0.tar.gz -OL + tar xf libclang_rt.builtins-wasm32-wasi-15.0.tar.gz + ``` + +2. Extract the `wasi-sysroot-*.tar.gz` archive on your local system and + set `WASI_SYSROOT_PATH` to its path. + + For example: + + ```shell + cd ~ + curl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-15/wasi-sysroot-15.0.tar.gz -OL + tar xf wasi-sysroot-15.0.tar.gz + export WASI_SYSROOT_PATH=~/wasi-sysroot + ``` diff --git a/docs/howto/judoc.md b/docs/howto/judoc.md new file mode 100644 index 000000000..e9211df66 --- /dev/null +++ b/docs/howto/judoc.md @@ -0,0 +1 @@ +# Documenting Juvix programs with Judoc diff --git a/docs/org/notes/README.org b/docs/notes/README.md similarity index 100% rename from docs/org/notes/README.org rename to docs/notes/README.md diff --git a/docs/notes/builtins.md b/docs/notes/builtins.md new file mode 100644 index 000000000..4ce8ad30c --- /dev/null +++ b/docs/notes/builtins.md @@ -0,0 +1,82 @@ +--- +author: Jan Mas Rovira +title: Builtins +--- + +# Overview + +The goal is to support builtin types and functions that get compiled to +efficient primitives. We plan on supporting primitives for the following +types of definitions: + +1. Builtin inductive definitions. For example: + + ```juvix + builtin nat + type Nat := + zero : Nat | + suc : Nat → Nat; + ``` + + We will call this the canonical definition of natural numbers. + +2. Builtin function definitions. For example: + + ```juvix + inifl 6 +; + builtin nat-plus + + : Nat → Nat → Nat; + + zero b := b; + + (suc a) b := suc (a + b); + ``` + +3. Builtin axiom definitions. For example: + + ```juvix + builtin nat-print + axiom printNat : Nat → Action; + ``` + +## Collecting builtin information + +The idea is that builtin definitions are treated normally throughout the +pipeline except in the backend part. There is one exception to that. We +need to collect information about the builtins that have been included +in the code and what are the terms that refer to them. For instance, +imagine that we find this definitions in a juvix module: + +```juvix +builtin nat +type MyNat := + z : MyNat | + s : MyNat → MyNat; +``` + +We need to take care of the following: + +1. Check that the definition `MyInt` is up to renaming equal to the + canonical definition that we provide in the compiler. +2. Rember a map from concrete to canonical names: {MyNat ↦ Nat; z ↦ + zero; s ↦ suc}; +3. Rembember that we have a definition for builtin natural numbers. + This is necessary if later we attempt to define a builtin function + or axiom that depends on natural numbers. + +In the compiler we need to know the following: + +1. For inductives: + 1. What is the primitive type that we will target in the backend: + E.g. {Nat ↦ int}. + 2. For constructors: + 1. What is the primitive constructor function: E.g. {zero ↦ 0; + suc ↦ plusone}; + 2. How to test if a term matches a pattern with that + constructor. E.g. {zero ↦ iszero; suc ↦ + isnotzero}; + 3. How to deconstruct/project each of the constructor + arguments. E.g. {zero ↦ ∅; suc ↦ minusone}}. Note + that if a constructor takes multiple arguments we will need + to have a projection function for each argument. +2. For functions and axioms: + 1. What is the primitive function that we will target in the + backend: E.g. {+ ↦ add}. diff --git a/docs/notes/lsp.md b/docs/notes/lsp.md new file mode 100644 index 000000000..10197fb3b --- /dev/null +++ b/docs/notes/lsp.md @@ -0,0 +1,16 @@ +# LSP support + +We provide a sample `hie.yaml` configuration file for both `cabal` and +`stack`. + +If you prefer `stack`, run: + +```shell +cp stack.hie.yaml hie.yaml +``` + +If you prefer `cabal`, run: + +```shell +cp cabal.hie.yaml hie.yaml +``` diff --git a/docs/notes/monomorphization.md b/docs/notes/monomorphization.md new file mode 100644 index 000000000..3df563e18 --- /dev/null +++ b/docs/notes/monomorphization.md @@ -0,0 +1,228 @@ +--- +author: Jan Mas Rovira +--- + +# Monomorphization + +(Removed in v0.2.5) + +Monomorphization refers to the process of converting polymorphic code to +monomorphic code (no type variables) through static analysis. + +Example: + +```juvix +id : (A : Type) → A → A; +id _ a := a; + +b : Bool; +b := id Bool true; + +n : Nat; +n := id Nat zero; +``` + +Is translated into: + +```juvix +id_Bool : Bool → Bool; +id_Bool a := a; + +id_Nat : Nat → Nat; +id_Nat a := a; +``` + +# More examples + +## Mutual recursion + +```juvix +type List (A : Type) := + nil : List A | + cons : A → List A → List A; + +even : (A : Type) → List A → Bool; +even A nil := true ; +even A (cons _ xs) := not (odd A xs) ; + +odd : (A : Type) → List A → Bool; +odd A nil := false ; +odd A (cons _ xs) := not (even A xs) ; + +-- main := even Bool .. odd Nat; +``` + +# Collection algorithm + +This section describes the algorithm to collect the list of all concrete +functions and inductive definitions that need to be generated. + +## Assumptions: + +1. Type abstractions only appear at the leftmost part of a type + signature. +2. All functions and constructors are fully type-applied: i.e. currying + for types is not supported. +3. There is at least one function with a concrete type signature. +4. All axioms are monomorphic. +5. No module parameters. + +## Definitions + +1. **Application**. An application is an expression of the form + `t₁ t₂ … tₙ` with n > 0. + +2. **Sub application**. If `t₁ t₂ … tₙ` is an application then for + every `0 1`. For each `âᵢ` we proceed as follows in the next + sections. Fix `m` to be the lenght of `âᵢ` with `m > 0`. + +### Function name + +The name of the monomorphized function is `⋆(f âᵢ)`. + +### Type signature + +Let `𝒮` be the type signature of `f`. Then `𝒮` has to be of the form +`(A₁ : + Type) → … → (Aₘ : Type) → Π`, where `Π` is a type with no type +abstractions. Now consider the substitution +`σ = {A₁ ↦ âᵢ[1], …, Aₘ ↦ âᵢ[m]}`. Since `âᵢ` is a list of concrete +types, it is clear that `σ(Π)` is a concrete type. Then proceed as +described in _Types_. + +### Function clause + +Let `𝒞` be a function clause of `f`. Let `p₁ … pₖ` with `k ≥ m` be the +list of patterns in `𝒞`. Clearly the first `m` patterns must be either +variables or wildcards. Wlog assume that the first `m` patterns are all +variables, namely `v₁, …, vₘ`. Let `σ = {v₁ ↦ âᵢ[1], …, Aₘ ↦ âᵢ[m]}` be +a substitution. Let `e` be the body of `𝒞`, then clearly `σ(e)` has no +type variables in it. Now, since each name id must be bound at most +once, we need to generate new ones for the local variables bound in the +patterns `pₘ₊₁, …, pₖ`. Let `w₁, …, wₛ` be the variables bound in +`pₘ₊₁, …, pₖ`. Let `w'₁, …, w'ₛ` be fresh variables. Then let +`δ = {w₁ ↦ w'₁, …, wₛ ↦ w'ₛ}`. + +Now let `𝒞'` have patterns `δ(pₘ₊₁), …, δ(pₖ)` and let `e' :` (σ ∪ +δ)(e)=. It should be clear that `e'` has no type variables in it and +that all local variable references in `e'` are among `w'₁, …, w'ₛ`. Note +that `e'` is not yet monomorphized. Proceed to the next step to achieve +that. + +### Expressions + +The input is an expression `e` that has no type variables in it. The +goal is to replace the concrete type applications by the corresponding +monomorphized expression. + +The only interesting case is when we find an application. Consider the +unfolded view of the application: `f a₁ … aₘ`. Then, if `f` is either a +constructor, or a function, let `A₁, …, Aₖ` with `k ≤ m` be the list of +type parameters of `f`. + +- If `f` is a function and `f a₁ … aₖ ∉ ℒ` then recurse normally, + otherwise, let `â :` a₁ … aₖ= and replace the original expression + `f a₁ … aₘ`, by `⋆(f â) +aₖ₊₁' … aₘ'` where `aₖ₊₁' … aₘ'` are the monomorphization of + `aₖ₊₁ … aₘ` respectively. +- If `f` is a constructor, let `d` be its inductive type. Then check + `d a₁ … aₖ +∈ ℒ`. Proceed analogously as before. + +### Types + +The input is a type `t` that has no type variables in it. The goal is to +replace the concrete type applications by the corresponding +monomorphized type. Proceed analogously to the previous section. diff --git a/docs/notes/runtime-benchmark-results.md b/docs/notes/runtime-benchmark-results.md new file mode 100644 index 000000000..7a2e4a458 --- /dev/null +++ b/docs/notes/runtime-benchmark-results.md @@ -0,0 +1,343 @@ +# Benchmarks of the new Juvix runtime + +Benchmarked version: commit 148ececb4d4259eacbb980f5992073a3ac611d82 +from 31.10.2022 + +## Summary + +We benchmark several programs manually compiled into the primitives of +the new Juvix runtime. The code corresponds closely to the code that +will be generated by the new compilation process, with basic low-level +optimisations (unboxing, untagging, etc.) but without any high-level +optimisations on JuvixCore (inlining, specialisation, constant folding, +fusion, etc.). This corresponds to the compilation process planned for +the 0.4 milestone. + +We compare the running time and memory usage with analogous programs +written in Haskell, OCaml, JuvixCore (using the evaluator), current +Juvix (with the "direct" transpilation to C) and C. + +The results suggest that for most first-order programs the new +compilation process will produce code with running time comparable to +the code produced by the native OCaml compiler. For higher-order +programs heavy on closure manipulation, the results are acceptable but +noticeably worse, especially with third-order functions (i.e. functions +which take functions taking functions). This could, however, be +alleviated by implementing the specialisation optimisation (see the +"specialised" column in the \`ackermann\` and \`mapfun\` benchmarks). +Besides, functional programs of order higher than two are rare. + +The comparisons with OCaml and Haskell were not entirely fair because +the new Juvix runtime does not perform garbage collection. The overhead +of garbage collection is particularly visible on the \`mergesort\` +benchmark which creates many intermediate data structures that are +quickly discarded. With proper memory management, the running time +results on first-order programs for the new Juvix runtime are expected +to become slightly worse than for the native OCaml compiler. + +For simple programs operating on integers which don't require any heap +memory allocation (\`fibonacci\` and \`combinations\` benchmarks), the +direct transpilation to C in the current Juvix seems to perform best +(behind only C). The reason is that for very simple programs \`clang\` +can better optimise the output of such a direct transpiler. The main +problem with the transpilation to C approach is that it cannot scale to +reliably work for more complex programs, as evidenced by the segfaults, +longer running time and higher memory use on other benchmarks. + +In addition to the \`fibonacci\` and \`combinations\` benchmarks, the +advantage of direct transpilation for very simple programs is also +visible on the \`fold\` benchmark where a simple loop over a list +dominates the running time. However, this is partly because the +compilation of closures in current Juvix is incorrect allowing it to be +more efficient. + +## Benchmark programs + +# fibonacci: compute the Nth Fibonacci number modulo 228 (N = 100’000’000) + +The Nth Fibonacci number is computed in O(N). Needs only constant stack +space and no heap memory. This benchmark tests the efficiency of tail +recursion and arithmetic operations. + +# combinations: count combinations of numbers 1 to N having sum N (N = 100) + +This benchmark tests the efficiency of general recursion. No heap memory +needs to be allocated. Uses stack space proportional to N. The running +time is exponential in N. + +# prime: compute the Nth prime (N = 16384) + +The Nth prime number is computed via the Eratosthenes sieve. A list of N +primes is created. No intermediate lists are discarded (garbage +collection not needed). This benchmark tests the efficiency of tail +recursion, arithmetic operations, list cell allocation and access. + +# mergesort: merge sort a list of N integers (N = 2’000’000) + +At each level of merge sort intermediate lists are created and +discarded. The running time for this benchmark largely depends on the +efficiency of memory management. Here one may observe the overhead of +garbage collection or the memory blow-up if no garbage collection is +used. + +# maybe: optionally sum N integers from a binary tree K times (N = 220, K = 100) + +If a fixed number k is encountered in the tree then the result is +\`Nothing\`, otherwise it is \`Just sum\`. The computation is repeated +for values of k from 0 to K. This tests the efficiency of handling +optional values and data structure access. + +# fold: fold a list of N integers K times (N = 100’000, K = 1000) + +The sum of N natural numbers is computed via foldleft +(tail-recursive). The computation is repeated K times. The list is +created only once, so that allocation time does not dominate. This +benchmark tests the efficiency of closure call and list cell access. + +# cps: compute the Nth Fibonacci number modulo 228 with CPS (N = 100’000’000) + +The function computing the Nth Fibonacci number is written in +continuation-passing style, tail-recursively calling a continuation +supplied as an argument. This benchmark tests the efficiency of closure +call and allocation. + +# mapfold: map and fold a list of N integers K times (N = 10000, K = 10000) + +This benchmark tests the efficiency of standard higher-order functions +on lists, closure call and memory management. The program allocates O(K) +intermediate lists of length N which are quickly discarded. + +# ackermann: compute Ack(3, N) with the higher-order Ackermann function definition (N = 11) + +The higher-order Ackermann function definition iterates an iteration of +function compositions. Hence, it uses a third-order invocation of an +iteration function. This benchmark tests the efficiency of creating and +calling second-order closures, and of partial application. + +# mapfun: successively map K functions to a list of N integers (K = 100, N = 10000) + +The benchmark stores K second-order closures in a list, maps them +successively to a list of K closures, and then successively maps the K +closures from the result to a list of N integers. This benchmark tests +the efficiency of manipulating closures and storing them in data +structures. + +The benchmark programs can be found in \`tests/benchmark\` in the Juvix +source directory. + +## Methodology + +For each program the total running time (elapsed real time) and memory +use (maximum resident set size) were measured on an M1 iMac with no +significant background activity. Averages of several runs were taken. +The variance was negligible, unless indicated otherwise by providing a +range. + +## Results + +# fibonacci: compute the Nth Fibonacci number modulo 228 (N = 100’000’000) + +| | New Juvix runtime (native) | New Juvix runtime (wasm32, wasmer) | Current Juvix (native) | Current Juvix (wasm32, wasmer) | JuvixCore evaluator | Haskell (native, ghc -O2) | Haskell (native, ghc -XStrict -O2) | OCaml (native, ocamlopt -O2) | OCaml (bytecode) | C (native, clang -O3) | C (wasm32, clang -Os, wasmer) | +| ------------------------ | -------------------------- | ---------------------------------- | ---------------------- | ------------------------------ | ------------------- | ------------------------- | ---------------------------------- | ---------------------------- | ---------------- | --------------------- | ----------------------------- | +| Time (seconds, real) | 0.26 | 0.35 | 0.35 | 0.23 | 13.15 | 10.03 | 0.39 | 0.35 | 0.94 | 0.16 | 0.22 | +| Memory use (MB, max RSS) | 1.5 | 3.8 | 1.3 | 8.8 | 21.3 | 8067.7 | 9.7 | 1.7 | 1.8 | 1.3 | 4.0 | + +# combinations: count all combinations of numbers 1 to N having sum N (N = 1000) + +| | New Juvix runtime (native) | New Juvix runtime (wasm32, wasmer) | Current Juvix (native) | Current Juvix (wasm32, wasmer) | JuvixCore evaluator | Haskell (native, ghc -O2) | Haskell (native, ghc -XStrict -O2) | OCaml (native, ocamlopt -O2) | OCaml (bytecode) | C (native, clang -O3) | C (wasm32, clang -Os, wasmer) | +| ------------------------ | -------------------------- | ---------------------------------- | ---------------------- | ------------------------------ | ------------------- | ------------------------- | ---------------------------------- | ---------------------------- | ---------------- | --------------------- | ----------------------------- | +| Time (seconds, real) | 6.67 | 11.25 | 3.22 | 5.1 | 441.71 | 5.48 | 5.48 | 6.53 | 41.08 | 2.69 | 4.80 | +| Memory use (MB, max RSS) | 1.5 | 3.9 | 1.3 | 8.9 | 22.3 | 9.6 | 9.6 | 1.7 | 1.9 | 1.3 | 4.0 | + +# prime: compute the Nth prime (N = 16384) + +| | New Juvix runtime (native) | New Juvix runtime (wasm32, wasmer) | Current Juvix (native) | Current Juvix (wasm32, wasmer) | JuvixCore evaluator | Haskell (native, ghc -O2) | Haskell (native, ghc -XStrict -O2) | OCaml (native, ocamlopt -O2) | OCaml (bytecode) | C (native, clang -O3) | C (wasm32, clang -Os, wasmer) | +| ------------------------ | -------------------------- | ---------------------------------- | ---------------------- | ------------------------------ | ------------------- | ------------------------- | ---------------------------------- | ---------------------------- | ---------------- | --------------------- | ----------------------------- | +| Time (seconds, real) | 1.52 | 1.91 | segfault | 3.09 | 167.04 | 3.85 | 3.85 | 1.68 | 14.82 | 0.12 | 0.13 | +| Memory use (MB, max RSS) | 1.7 | 4.0 | segfault | 9.3 | 24.4 | 9.8 | 9.6 | 2.2 | 2.2 | 1.4 | 4.0 | + +# mergesort: merge sort a list of N integers (N = 2’000’000) + +| | New Juvix runtime (native) | New Juvix runtime (wasm32, wasmer) | Current Juvix (native) | Current Juvix (wasm32, wasmer) | JuvixCore evaluator | Haskell (native, ghc -O2) | Haskell (native, ghc -XStrict -O2) | OCaml (native, ocamlopt -O2) | OCaml (bytecode) | C (native, clang -O3) | C (wasm32, clang -Os, wasmer) | +| ------------------------ | -------------------------- | ---------------------------------- | ---------------------- | ------------------------------ | ------------------- | ------------------------- | ---------------------------------- | ---------------------------- | ---------------- | --------------------- | ----------------------------- | +| Time (seconds, real) | 0.40 | 0.31 | 3.55 | 1.32 | 22.45 | 2.86 | 2.90 | 1.95 | 3.52 | 0.15 | 0.15 | +| Memory use (MB, max RSS) | 1973.7 | 720.4 | 5046.7 | 2729.8 | 1728.9 | 253.6 | 253.6 | 172.6 | 343.1 | 24.4 | 26.8 | + +# maybe: optionally sum N non-zero integers from a binary tree K times (N = 220, K = 100) + +| | New Juvix runtime (native) | New Juvix runtime (wasm32, wasmer) | Current Juvix (native) | Current Juvix (wasm32, wasmer) | JuvixCore evaluator | Haskell (native, ghc -O2) | Haskell (native, ghc -XStrict -O2) | OCaml (native, ocamlopt -O2) | OCaml (bytecode) | C (native, clang -O3) | C (wasm32, clang -Os, wasmer) | +| ------------------------ | -------------------------- | ---------------------------------- | ---------------------- | ------------------------------ | ------------------- | ------------------------- | ---------------------------------- | ---------------------------- | ---------------- | --------------------- | ----------------------------- | +| Time (seconds, real) | 0.45 | 0.64 | 3.29 | 1.57 | 22.75 | 5.58 | 0.59 | 0.30 | 3.57 | 0.27 | 0.50 | +| Memory use (MB, max RSS) | 1.6 | 3.8 | 2646.1 | 1320.9 | 22.4 | 5560.7 | 9.7 | 3.9 | 4.0 | 1.3 | 4.1 | + +# fold: fold a list of N integers K times (N = 100’000, K = 1000) + +| | New Juvix runtime (native) | New Juvix runtime (wasm32, wasmer) | Current Juvix (native) | Current Juvix (wasm32, wasmer) | JuvixCore evaluator | Haskell (native, ghc -O2) | Haskell (native, ghc -XStrict -O2) | OCaml (native, ocamlopt -O2) | OCaml (bytecode) | C (native, clang -O3) | C (wasm32, clang -Os, wasmer) | +| ------------------------ | -------------------------- | ---------------------------------- | ---------------------- | ------------------------------ | ------------------- | ------------------------- | ---------------------------------- | ---------------------------- | ---------------- | --------------------- | ----------------------------- | +| Time (seconds, real) | 0.45 | 0.54 | 0.35 | 0.23 | 15.27 | 0.58 | 0.58 | 0.36 | 1.80 | NA | NA | +| Memory use (MB, max RSS) | 3.1 | 4.6 | 4.4 | 10.6 | 43.4 | 12.7 | 12.7 | 5.9 | 5.9 | NA | NA | + +# cps: compute the Nth Fibonacci number modulo 228 with CPS (N = 100’000’000) + +| | New Juvix runtime (native) | New Juvix runtime (wasm32, wasmer) | Current Juvix (native) | Current Juvix (wasm32, wasmer) | JuvixCore evaluator | Haskell (native, ghc -O2) | Haskell (native, ghc -XStrict -O2) | OCaml (native, ocamlopt -O2) | OCaml (bytecode) | C (native, clang -O3) | C (wasm32, clang -Os, wasmer) | +| ------------------------ | -------------------------- | ---------------------------------- | ---------------------- | ------------------------------ | ------------------- | ------------------------- | ---------------------------------- | ---------------------------- | ---------------- | --------------------- | ----------------------------- | +| Time (seconds, real) | 0.43 | 0.52 | 1.56 | stack overflow | 20.22 | 10.04 | 0.39 | 0.35 | 1.60 | 0.16 | 0.25 | +| Memory use (MB, max RSS) | 1.5 | 3.9 | 1539.3 | stack overflow | 21.3 | 8067.7 | 9.7 | 1.7 | 1.8 | 1.3 | 4.0 | + +# mapfold: map and fold a list of N integers K times (N = 10000, K = 10000) + +| | New Juvix runtime (native) | New Juvix runtime (wasm32, wasmer) | Current Juvix (native) | Current Juvix (wasm32, wasmer) | JuvixCore evaluator | Haskell (native, ghc -O2) | Haskell (native, ghc -XStrict -O2) | OCaml (native, ocamlopt -O2) | OCaml (bytecode) | C (native, clang -O3) | C (wasm32, clang -Os, wasmer) | +| ------------------------ | -------------------------- | ---------------------------------- | ---------------------- | ------------------------------ | ------------------- | ------------------------- | ---------------------------------- | ---------------------------- | ---------------- | --------------------- | ----------------------------- | +| Time (seconds, real) | 1.01 | 1.59 | 2.74 | 1.81 | 38.24 | 1.29 | 2.42 | 1.43 | 4.22 | NA | NA | +| Memory use (MB, max RSS) | 2154.5 | 893.0 | 3059.1 | 1542.0 | 26.4 | 10.6 | 10.7 | 7.5 | 10-20 | NA | NA | + +# ackermann: compute Ack(3, N) with the higher-order Ackermann function definition (N = 11) + +| | New Juvix runtime (native) | New Juvix runtime (wasm32, wasmer) | New Juvix runtime (specialised, native) | New Juvix runtime (specialised, wasm32, wasmer) | Current Juvix (native) | Current Juvix (wasm32, wasmer) | JuvixCore evaluator | Haskell (native, ghc -O2) | Haskell (native, ghc -XStrict -O2) | OCaml (native, ocamlopt -O2) | OCaml (bytecode) | C (native, clang -O3) | C (wasm32, clang -Os, wasmer) | +| ------------------------ | -------------------------- | ---------------------------------- | --------------------------------------- | ----------------------------------------------- | ---------------------- | ------------------------------ | ------------------- | ------------------------- | ---------------------------------- | ---------------------------- | ---------------- | --------------------- | ----------------------------- | +| Time (seconds, real) | 0.92 | 1.21 | 0.30 | 0.65 | segfault | runtime error | 11.71 | 0.87 | 0.47 | 0.54 | 1.35 | 0.00 | 0.14 | +| Memory use (MB, max RSS) | 2.6 | 4.1 | 2.3 | 3.9 | segfault | runtime error | 23.3 | 13.6 | 9.6 | 2.0 | 3.6 | 1.3 | 4.0 | + +# mapfun: successively map K functions to a list of N integers (K = 100, N = 10000) + +| | New Juvix runtime (native) | New Juvix runtime (wasm32, wasmer) | New Juvix runtime (specialised, native) | New Juvix runtime (specialised, wasm32, wasmer) | Current Juvix (native) | Current Juvix (wasm32, wasmer) | JuvixCore evaluator | Haskell (native, ghc -O2) | Haskell (native, ghc -XStrict -O2) | OCaml (native, ocamlopt -O2) | OCaml (bytecode) | C (native, clang -O3) | C (wasm32, clang -Os, wasmer) | +| ------------------------ | -------------------------- | ---------------------------------- | --------------------------------------- | ----------------------------------------------- | ---------------------- | ------------------------------ | ------------------- | ------------------------- | ---------------------------------- | ---------------------------- | ---------------- | --------------------- | ----------------------------- | +| Time (seconds, real) | 1.27 | 1.04 | 0.39 | 0.46 | segfault | runtime error | 4.18 | 1.85 | 0.95 | 0.19 | 0.68 | NA | NA | +| Memory use (MB, max RSS) | 3209.8 | 1229.7 | 21.8 | 13.2 | segfault | runtime error | 33.0 | 13.6 | 11.6 | 5.3 | 7.9 | NA | NA | + +Comments + +--- + +# "New Juvix runtime" denotes C programs written using the primitives + +of the new Juvix runtime. These programs were "manually" compiled from +the corresponding Juvix/JuvixCore programs, according to the new Juvix +compilation concept. They correspond closely to the code that will be +generated by the basic version of the new compilation process, without +any high-level optimisations (inlining, specialisation, fusion, constant +folding) but with basic low-level memory representation optimisations +(unboxing, untagging, etc). This version of the new compilation process +should be finished with the 0.4 milestone. + +# The "specialised" column for "New Juvix runtime" denotes a version + +of the corresponding "New Juvix runtime" benchmark program for which +specialisation of higher-order functions was manually performed (to +simulate the effects of the high-level specialisation optimisation). + +# "Current Juvix" denotes Juvix programs compiled with the current + +compilation process via a "direct" translation to C. For a fair +comparison, all number operations were implemented using native binary C +integers (exposed via \`foreign\` and \`compile\` blocks) without +overflow check, instead of using the unary Nat from the standard +library. For Haskell, we use the fixed-precision Int instead of the +arbitrary-precision Integer. + +# For the simplest benchmark programs without heap memory allocation + +(e.g. \`fibonacci\`, \`combinations\`), the performance of "Current +Juvix" is comparable to or better than that of "New Juvix runtime". This +is because \`clang\` managed to eliminate (tail) recursion and optimise +the code to essentially the same or better thing. The main problem with +the current "direct" transpilation to C approach is that it cannot scale +to reliably work for more complex programs. By "more complex" I mean +larger program size, more functions, more complex patterns of recursion +and/or the use of more functional programming features (including +functional data structures). I don't mean higher computational +complexity or more resource use. + +# The segfaults and runtime errors for "Current Juvix" are + +consequences of incorrectly generated code (current compilation of +partial application is not entirely correct) or stack overflows (when +\`clang\` didn't figure out how to eliminate tail recursion). + +# The comparison with "Current Juvix" is not entirely fair for + +benchmarks that test the manipulation and calling of closures (e.g. +\`fold\`). Current Juvix achieves good performance (when it doesn't +segfault) at the expense of correctness: partial application is not +compiled correctly and fixing this would require a fundamental change in +closure representation. + +# The comparison with Haskell and OCaml compilers is not entirely + +fair, because the new Juvix runtime does not perform garbage collection. +With the GC overhead, I would expect the Juvix runtime results for +native compilation of first-order programs to become a bit worse than +the native OCaml versions. The GC overhead is particularly noticeable +for the \`mergesort\` benchmark which creates many large intermediate +lists. The memory usage of the Juvix runtime is much higher on this +benchmark than the memory usage of OCaml or Haskell versions. The +relatively small time difference between the OCaml native and bytecode +versions of \`mergesort\` also indicates that GC accounts for a +significant part of the running time. + +# Another small overhead will be introduced by bounds checking for + +integer operations. Currently, the new Juvix runtime operates on unboxed +31-bit (or 63-bit) integers without checking for integer overflow. + +# If we decide to default to transparent arbitrary-precision integers, + +then another small overhead will be introduced by the need to check the +integer representation with each arithmetic operation. + +# Admittedly, the programs were deliberately written in a way to make + +high-level optimisations unnecessary, except specialisation for +higher-order functions (mostly in \`ackermann\` and \`mapfun\`). This +also explains the good performance of the OCaml native compiler which +doesn't do much high-level optimisation. + +# In the "Current Juvix" and OCaml version of \`mergesort\`, to avoid + +stack overflow the \`merge\` function was written tail-recursively with +accumulator reversal at the end. This is not necessary for the new Juvix +runtime, because the stack is dynamically extended when needed. + +# As evidenced by the \`combinations\` benchmark, for non-tail-recursive + +direct calls our code performs worse than the code which uses the C / +WebAssembly stack and function call mechanisms. However, in general it +is impossible to directly use the C / WebAssembly stack and call +mechanisms for a purely functional language. Since we dynamically +allocate the stack segments when needed, stack overflow is impossible. +This is convenient in an eager functional language. Otherwise, one needs +to rewrite all functions operating on large data to use tail recursion. +We pay for this convenience with a small overhead, which is the main +reason for poorer performance on \`combinations\` where stack +manipulation cost dominates. + +# Haskell's laziness seems to introduce more overhead than I + +expected. This would explain the comparatively better performance of the +native OCaml compiler. The problem is particularly stark when Haskell's +strictness analysis fails for some reason, as in the \`fibonacci\` +benchmark. The second "Haskell" column with the "-XStrict" flag for GHC +indicates the version of the benchmark compiled with strictness as the +default. + +# The C versions of the programs were written to take advantage of C's + +imperative features, e.g., using arrays instead of lists, loops instead +of recursion. No C versions are provided for some benchmarks designed to +test specifically functional language features. + +# With the new Juvix runtime, the 32-bit WebAssembly version of + +\`mergesort\` is faster than the 64-bit native version because it needs +roughly half as much memory (the word size is 4 bytes instead of 8). The +difference is even starker between the WebAssembly and native versions +of \`mergesort\` for "Current Juvix". + +# There seems to be a memory leak in the JuvixCore evaluator. This is + +what happens too often when one uses a lazy language. + +# Haskell also leaks memory in the Fibonacci benchmark, despite it + +being a simple tail-recursive program. It seems strictness analysis +didn't work. diff --git a/docs/notes/strictly-positive-data-types.md b/docs/notes/strictly-positive-data-types.md new file mode 100644 index 000000000..f845a6d67 --- /dev/null +++ b/docs/notes/strictly-positive-data-types.md @@ -0,0 +1,77 @@ +# Strictly positive data types + +We follow a syntactic description of strictly positive inductive data +types. + +An inductive type is said to be strictly positive if it does not +occur or occurs strictly positively in the types of the arguments of its +constructors. A name qualified as strictly positive for an inductive +type if it never occurs at a negative position in the types of the +arguments of its constructors. We refer to a negative position as those +occurrences on the left of an arrow in a type constructor argument. + +In the example below, the type `X` occurs strictly positive in `c0` and +negatively at the constructor `c1`. Therefore, `X` is not strictly +positive. + +```minijuvix +axiom B : Type; +type X := + c0 : (B -> X) -> X + | c1 : (X -> X) -> X; +``` + +We could also refer to positive parameters as such parameters occurring +in no negative positions. For example, the type `B` in the `c0` +constructor above is on the left of the arrow `B->X`. Then, `B` is at a +negative position. Negative parameters need to be considered when +checking strictly positive data types as they may allow defining +non-strictly positive data types. + +In the example below, the type `T0` is strictly positive. However, the +type `T1` is not. Only after unfolding the type application `T0 (T1 A)` +in the data constructor `c1`, we can find out that `T1` occurs at a +negative position because of `T0`. More precisely, the type parameter +`A` of `T0` is negative. + +```minijuvix +type T0 (A : Type) := c0 : (A -> T0 A) -> T0 A; + +type T1 := c1 : T0 T1 -> T1; +``` + +## Bypass the strict positivity condition + +To bypass the positivity check, a data type declaration can be annotated +with the keyword `positive`. Another way is to use the CLI global flag +`--no-positivity` when type checking a `Juvix` File. + +```juvix +$ cat tests/negative/MicroJuvix/NoStrictlyPositiveDataTypes/E5.mjuvix +module E5; + positive + type T0 (A : Type) := + c0 : (T0 A -> A) -> T0 A; +end; +``` + +## Examples of non-strictly data types + +- `Bad` is not strictly positive because of the negative parameter + `A` of `Tree`. + + ```juvix + type Tree (A : Type) := + leaf : Tree A + | node : (A -> Tree A) -> Tree A; + + type Bad := + bad : Tree Bad -> Bad; + ``` + +- `A` is a negative parameter. + + ```juvix + type B (A : Type) := + b : (A -> B (B A -> A)) -> B A; + ``` diff --git a/docs/org/SUMMARY.org b/docs/org/SUMMARY.org deleted file mode 100644 index 32d8fc003..000000000 --- a/docs/org/SUMMARY.org +++ /dev/null @@ -1,45 +0,0 @@ -* Summary - -- [[./README.md][The Juvix project]] -- [[./changelog.md][Changelog]] -- [[./quick-start.md][Quick start]] - -* Tutorials -- [[./tutorials/learn.md][Learn Juvix in minutes]] -- [[./tutorials/structure.md][Structuring Juvix projects]] -- [[./tutorials/emacs.md][Juvix Emacs mode]] -- [[./tutorials/vscode.md][Juvix VSCode extension]] - -* How-to guides -- [[./howto/installing.md][Installing Juvix]] -- [[./howto/compilation.md][Compiling Juvix programs]] -- [[./howto/judoc.md][Judoc: Juvix documentation tool]] - -* Explanations -- [[./explanations/typetheory.md][Type theory]] -- [[./explanations/totality/README.md][Totality checking]] - - [[./explanations/totality/termination.md][Termination]] - - [[./explanations/totality/positive.md][Strictly positive data types]] - - [[./explanations/totality/coverage.md][Coverage checking]] - -* Reference -- [[./reference/stdlib.md][Standard library]] -- [[./reference/language/README.md][Language reference]] - - [[./reference/language/functions.md][Functions]] - - [[./reference/language/datatypes.md][Data types]] - - [[./reference/language/modules.md][Modules]] - - [[./reference/language/let.md][Local definitions]] - - [[./reference/language/control.md][Control structures]] - - [[./reference/language/comments.md][Comments]] - - [[./reference/language/axioms.md][Axioms]] -- [[./reference/examples.md][Example programs]] -- [[./reference/benchmarks.md][Benchmarks]] -- [[./reference/tooling/README.md][Tooling]] - - [[./reference/tooling/CLI.md][Command line interface]] - - [[./reference/tooling/doctor.md][Doctor]] - - [[./reference/tooling/emacs.md][Emacs mode]] - - [[./reference/tooling/testing.md][Haskell test suite]] -- [[./reference/judoc.md][Judoc reference]] - -* About -- [[./about/community.md][Community]] diff --git a/docs/org/about/community.org b/docs/org/about/community.org deleted file mode 100644 index 168728ada..000000000 --- a/docs/org/about/community.org +++ /dev/null @@ -1,7 +0,0 @@ -* Juvix community - -Join us on our [[https://discord.gg/waYhQ2Qr][Discord server]] - -This project is part of a bigger effort called [[https://anoma.net/][Anoma]]. -Anoma is a suite of protocols and mechanisms for self-contained, self-sovereign coordination. -Join the [[https://anoma.net/community][Anoma project]]. diff --git a/docs/org/about/team.org b/docs/org/about/team.org deleted file mode 100644 index 2ddecf583..000000000 --- a/docs/org/about/team.org +++ /dev/null @@ -1 +0,0 @@ -* The Juvix Dev Team diff --git a/docs/org/examples/README.org b/docs/org/examples/README.org deleted file mode 100644 index a2083e701..000000000 --- a/docs/org/examples/README.org +++ /dev/null @@ -1,13 +0,0 @@ -** [[https://github.com/anoma/juvix/tree/main/examples/milestone][Examples of programs written in Juvix]] - -The following links are clickable versions of their corresponding Juvix programs. The HTML output can be generated by running =juvix html --recursive FileName.juvix=. - -- [[https://docs.juvix.org/examples/html/HelloWorld/HelloWorld.html][HelloWorld.juvix]] -- [[https://docs.juvix.org/examples/html/Fibonacci/Fibonacci.html][Fibonacci.juvix]] -- [[https://docs.juvix.org/examples/html/Hanoi/Hanoi.html][Hanoi.juvix]] -- [[https://docs.juvix.org/examples/html/PascalsTriangle/PascalsTriangle.html][PascalsTriangle.juvix]] -- [[https://docs.juvix.org/examples/html/Collatz/Collatz.html][Collatz.juvix]] -- [[https://docs.juvix.org/examples/html/TicTacToe/CLI/CLI.TicTacToe.html][TicTacToe.juvix]] - -The [[https://anoma.github.io/juvix-stdlib/][Juvix standard library]] contains -common functions that can be used in Juvix programs. diff --git a/docs/org/explanations/totality/termination.org b/docs/org/explanations/totality/termination.org deleted file mode 100644 index d90f49138..000000000 --- a/docs/org/explanations/totality/termination.org +++ /dev/null @@ -1,26 +0,0 @@ -* Termination - -To not bring inconsistencies by function declarations, Juvix -requires that every function passes its termination checker. -However, since this is a strong requirement, often tricky to fulfill, -we give the user the possibility to skip this check in two different ways: - -- Using the =terminating= keyword to annotate function type signatures as terminating. The syntax is the following. - -#+begin_example -terminating fun : A → B; -#+end_example - -Note that annotating a function as =terminating= means that /all/ its function -clauses pass the termination checker's criterion. To skip the termination -checker for mutual recursive functions, all the functions involved must be -annotated as =terminating=. - -- Using the CLI global flag =--no-termination=. - - -#+begin_example -juvix typecheck --no-termination MyProgram.juvix -#+end_example - -In any case, be aware that our termination checker is limited as it only accepts a subset of recursion functions. The termination checker algorithm is a slightly modification of the algorithm for checking termination in the Foetus's language. diff --git a/docs/org/howto/compilation.org b/docs/org/howto/compilation.org deleted file mode 100644 index 3d0f88ed7..000000000 --- a/docs/org/howto/compilation.org +++ /dev/null @@ -1,41 +0,0 @@ - -* Compiling simple programs - -A Juvix file must declare a module whose name corresponds exactly to the name of the file. For example, a file =Hello.juvix= must declare a module =Hello=: -#+begin_example --- Hello world example. This is a comment. -module Hello; - --- Import the standard library prelude, including the function 'printStringLn' -open import Stdlib.Prelude; - -main : IO; -main := printStringLn "Hello world!"; - -end; -#+end_example -A file compiled to an executable must define the zero-argument function =main= of type =IO= which is evaluated when running the program. - -To compile the file =Hello.juvix= type =juvix compile Hello.juvix=. Typing =juvix compile --help= will list all options to the =compile= command. - -* Compilation targets - -Since version 0.3 Juvix supports three compilation targets. The targets are specified with the =-t= option: =juvix compile -t target file.juvix=. - -1. =native=. This is the default. Produces a native 64bit executable for your machine. -2. =wasm32-wasi=. Produces a WebAssembly binary which uses the WASI runtime. -3. =geb=. Produces a [[https://anoma.github.io/geb/][GEB]] input file. - -* Juvix projects - -A _Juvix project_ is a collection of Juvix modules inside one main -project directory containing a =juvix.yaml= metadata file. The name of -each module must coincide with the path of the file it is defined in, -relative to the project's root directory. For example, if the file is -=root/Data/List.juvix= then the module must be called =Data.List=, -assuming =root= is the project's directory. - -To check that Juvix is correctly detecting your project's root, you -can run the command =juvix dev root File.juvix=. - -See also: [[../reference/language/modules.md][Modules Reference]]. diff --git a/docs/org/howto/installing.org b/docs/org/howto/installing.org deleted file mode 100644 index 5c32fc3a0..000000000 --- a/docs/org/howto/installing.org +++ /dev/null @@ -1,119 +0,0 @@ - -* Dependencies - -You need [[https://releases.llvm.org/download.html][Clang / LLVM]] version 13 or later. Note that on macOS the preinstalled clang does not support the wasm target, so use e.g. =brew install llvm= instead. - -If you want to compile to WebAssembly, you also need: -- [[https://wasmer.io][wasmer]] -- [[https://github.com/WebAssembly/wasi-sdk/releases][wasi-sdk]] -- [[https://lld.llvm.org][wasm-ld]] - the LLVM linker for WASM (NB: On Linux you may need to install the - =lld= package; on macOS this is installed as part of =llvm=). - -See [[./installing.md#installing-dependencies][below]] for instructions on how to install the dependencies. - -* Installing Juvix - -*** MacOS - -The easiest way to install Juvix on MacOS is by using [[https://brew.sh][Homebrew]]. - -To install the [[https://github.com/anoma/homebrew-juvix][homebrew-juvix tap]], run: - -#+begin_src shell -brew tap anoma/juvix -#+end_src - -To install Juvix, run: - -#+begin_src shell -brew install juvix -#+end_src - - -Helpful information can also be obtained by running: - -#+begin_src shell -brew info juvix -#+end_src - -*** Linux x86_64 - -A Juvix compiler binary executable for Linux x86_64 is available on the [[https://github.com/anoma/juvix/releases/latest][Juvix release page]]. - -To install this executable, download and unzip the linked file and move it -to a directory on your shell's =PATH=. - -For example if =~/.local/bin= is on your shell's =PATH=, you can install Juvix as -follows: - -#+begin_src shell -cd /tmp -curl -OL https://github.com/anoma/juvix/releases/download/v0.3.0/juvix-linux_x86_64-v0.3.0.zip -unzip juvix-linux_x86_64-v0.3.0.zip -mv juvix-linux_x86_64-v0.3.0 ~/.local/bin/juvix -#+end_src - -*** Building Juvix from source - -To install Juvix from source you must clone the [[https://github.com/anoma/juvix.git][Github repository]]. Then Juvix can be installed with the following commands. We assume you have [[https://haskellstack.org][Stack]] and [[https://www.gnu.org/software/make/][GNU Make]] installed. - -#+begin_src shell -git clone --recursive https://github.com/anoma/juvix.git -cd juvix -make install -#+end_src - -The C compiler and linker paths can be specified as options to the =make install= command, e.g. -#+begin_src shell -make install CC=path/to/clang LIBTOOL=path/to/llvm-ar -#+end_src - -On MacOS, you can alternatively run the following command for Homebrew. The flag -=--HEAD= used below is optional -- use it to build the latest version of Juvix in -the =main= branch on Github. - -#+begin_src shell -brew install --build-from-source --HEAD juvix --verbose -#+end_src - -*** Building the project with =cabal= - -We recommend to use the =stack= build tool with this project. - -If you prefer the =cabal= build tool instead, then you need to generate -the =juvix.cabal= file using [[https://github.com/sol/hpack][hpack]] before running =cabal build=. - -You also need to compile the runtime first: -#+begin_src shell -make runtime -cabal build -#+end_src - -* Installing dependencies - -To install =wasi-sdk= you need to download =libclang_rt= and =wasi-sysroot= -precompiled archives from the [[https://github.com/WebAssembly/wasi-sdk/releases/][wasi-sdk release page]] and: - -1. Extract the =libclang_rt.builtins-wasm32-wasi-*.tar.gz= archive in the - =clang= installation root (for example =/usr/lib/clang/13= on Ubuntu or - =`brew --prefix llvm`= on macos). - - For example on macos with homebrew clang: - - #+begin_src shell - cd `brew --prefix llvm` - curl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-15/libclang_rt.builtins-wasm32-wasi-15.0.tar.gz -OL - tar xf libclang_rt.builtins-wasm32-wasi-15.0.tar.gz - #+end_src - -2. Extract the =wasi-sysroot-*.tar.gz= archive on your local system and set - =WASI_SYSROOT_PATH= to its path. - - For example: - - #+begin_src shell - cd ~ - curl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-15/wasi-sysroot-15.0.tar.gz -OL - tar xf wasi-sysroot-15.0.tar.gz - export WASI_SYSROOT_PATH=~/wasi-sysroot - #+end_src diff --git a/docs/org/notes/builtins.org b/docs/org/notes/builtins.org deleted file mode 100644 index 7e0a189c8..000000000 --- a/docs/org/notes/builtins.org +++ /dev/null @@ -1,68 +0,0 @@ -#+title: Builtins -#+author: Jan Mas Rovira - -* Overview - -The goal is to support builtin types and functions that get compiled to -efficient primitives. We plan on supporting primitives for the following types -of definitions: - -1. Builtin inductive definitions. For example: - #+begin_example - builtin nat - type Nat := - zero : Nat | - suc : Nat → Nat; - #+end_example - We will call this the canonical definition of natural numbers. - -2. Builtin function definitions. For example: - #+begin_src text - inifl 6 +; - builtin nat-plus - + : Nat → Nat → Nat; - + zero b := b; - + (suc a) b := suc (a + b); - #+end_src - -3. Builtin axiom definitions. For example: - #+begin_src text - builtin nat-print - axiom printNat : Nat → Action; - #+end_src - -** Collecting builtin information - -The idea is that builtin definitions are treated normally throughout the -pipeline except in the backend part. There is one exception to that. We need to -collect information about the builtins that have been included in the code and -what are the terms that refer to them. For instance, imagine that we find this -definitions in a juvix module: -#+begin_src text -builtin nat -type MyNat := - z : MyNat | - s : MyNat → MyNat; -#+end_src -We need to take care of the following: -1. Check that the definition =MyInt= is up to renaming equal to the canonical - definition that we provide in the compiler. -2. Rember a map from concrete to canonical names: {MyNat ↦ Nat; z ↦ zero; s ↦ suc}; -3. Rembember that we have a definition for builtin natural numbers. This is - necessary if later we attempt to define a builtin function or axiom that - depends on natural numbers. - - -In the compiler we need to know the following: -1. For inductives: - 1. What is the primitive type that we will target in the backend: E.g. {Nat ↦ int}. - 2. For constructors: - 1. What is the primitive constructor function: E.g. {zero ↦ 0; suc ↦ plus_one}; - 2. How to test if a term matches a pattern with that constructor. - E.g. {zero ↦ is_zero; suc ↦ is_not_zero}; - 3. How to deconstruct/project each of the constructor arguments. E.g. {zero ↦ - ∅; suc ↦ minus_one}}. Note that if a constructor takes multiple arguments - we will need to have a projection function for each argument. -2. For functions and axioms: - 1. What is the primitive function that we will target in the backend: E.g. {+ - ↦ add}. diff --git a/docs/org/notes/lsp.org b/docs/org/notes/lsp.org deleted file mode 100644 index fb51333e5..000000000 --- a/docs/org/notes/lsp.org +++ /dev/null @@ -1,12 +0,0 @@ -* LSP support - -We provide a sample =hie.yaml= configuration file for both =cabal= and =stack=. - -If you prefer =stack=, run: -#+begin_src shell -cp stack.hie.yaml hie.yaml -#+end_src -If you prefer =cabal=, run: -#+begin_src shell -cp cabal.hie.yaml hie.yaml -#+end_src diff --git a/docs/org/notes/monomorphization.org b/docs/org/notes/monomorphization.org deleted file mode 100644 index aa972768e..000000000 --- a/docs/org/notes/monomorphization.org +++ /dev/null @@ -1,183 +0,0 @@ -#+author: Jan Mas Rovira - -* Monomorphization - -(Removed in v0.2.5) - - Monomorphization refers to the process of converting polymorphic code to - monomorphic code (no type variables) through static analysis. - - Example: - #+begin_src juvix - id : (A : Type) → A → A; - id _ a := a; - - b : Bool; - b := id Bool true; - - n : Nat; - n := id Nat zero; - #+end_src - - Is translated into: - #+begin_src juvix - id_Bool : Bool → Bool; - id_Bool a := a; - - id_Nat : Nat → Nat; - id_Nat a := a; - #+end_src - -* More examples -** Mutual recursion -#+begin_src juvix -type List (A : Type) := - nil : List A | - cons : A → List A → List A; - -even : (A : Type) → List A → Bool; -even A nil := true ; -even A (cons _ xs) := not (odd A xs) ; - -odd : (A : Type) → List A → Bool; -odd A nil := false ; -odd A (cons _ xs) := not (even A xs) ; - --- main := even Bool .. odd Nat; -#+end_src - -* Collection algorithm - This section describes the algorithm to collect the list of all concrete - functions and inductive definitions that need to be generated. - -** Assumptions: -1. Type abstractions only appear at the leftmost part of a type signature. -2. All functions and constructors are fully type-applied: i.e. currying for - types is not supported. -3. There is at least one function with a concrete type signature. -4. All axioms are monomorphic. -5. No module parameters. - -** Definitions -1. *Application*. An application is an expression of the form =t₁ t₂ … tₙ= with n > 0. - -2. *Sub application*. If =t₁ t₂ … tₙ= is an application then for every =0 1=. For each =âᵢ= we proceed as follows in the next sections. Fix =m= to be - the lenght of =âᵢ= with =m > 0=. - -*** Function name - The name of the monomorphized function is =⋆(f âᵢ)=. - -*** Type signature - Let =𝒮= be the type signature of =f=. Then =𝒮= has to be of the form =(A₁ : - Type) → … → (Aₘ : Type) → Π=, where =Π= is a type with no type abstractions. - Now consider the substitution =σ = {A₁ ↦ âᵢ[1], …, Aₘ ↦ âᵢ[m]}=. Since =âᵢ= is - a list of concrete types, it is clear that =σ(Π)= is a concrete type. - Then proceed as described in [[Types]]. - -*** Function clause - Let =𝒞= be a function clause of =f=. Let =p₁ … pₖ= with =k ≥ m= be the list of - patterns in =𝒞=. Clearly the first =m= patterns must be either variables or - wildcards. Wlog assume that the first =m= patterns are all variables, namely - =v₁, …, vₘ=. Let =σ = {v₁ ↦ âᵢ[1], …, Aₘ ↦ âᵢ[m]}= be a substitution. Let =e= - be the body of =𝒞=, then clearly =σ(e)= has no type variables in it. Now, since - each name id must be bound at most once, we need to generate new ones for the - local variables bound in the patterns =pₘ₊₁, …, pₖ=. Let =w₁, …, wₛ= - be the variables bound in =pₘ₊₁, …, pₖ=. Let =w'₁, …, w'ₛ= be fresh variables. - Then let =δ = {w₁ ↦ w'₁, …, wₛ ↦ w'ₛ}=. - - Now let =𝒞'= have patterns =δ(pₘ₊₁), …, δ(pₖ)= and let =e' := (σ ∪ δ)(e)=. It - should be clear that =e'= has no type variables in it and that all local - variable references in =e'= are among =w'₁, …, w'ₛ=. Note that =e'= is not yet - monomorphized. Proceed to the next step to achieve that. - -*** Expressions - The input is an expression =e= that has no type variables in it. The goal is to - replace the concrete type applications by the corresponding monomorphized - expression. - - The only interesting case is when we find an application. Consider the unfolded - view of the application: =f a₁ … aₘ=. Then, if =f= is either a constructor, or - a function, let =A₁, …, Aₖ= with =k ≤ m= be the list of type parameters of =f=. - - If =f= is a function and =f a₁ … aₖ ∉ ℒ= then recurse normally, otherwise, - let =â := a₁ … aₖ= and replace the original expression =f a₁ … aₘ=, by =⋆(f â) - aₖ₊₁' … aₘ'= where =aₖ₊₁' … aₘ'= are the monomorphization of =aₖ₊₁ … aₘ= - respectively. - - If =f= is a constructor, let =d= be its inductive type. Then check =d a₁ … aₖ - ∈ ℒ=. Proceed analogously as before. - -*** Types -The input is a type =t= that has no type variables in it. The goal is to -replace the concrete type applications by the corresponding monomorphized -type. Proceed analogously to the previous section. diff --git a/docs/org/notes/runtime-benchmark-results.org b/docs/org/notes/runtime-benchmark-results.org deleted file mode 100644 index e447f211f..000000000 --- a/docs/org/notes/runtime-benchmark-results.org +++ /dev/null @@ -1,326 +0,0 @@ -Benchmarks of the new Juvix runtime -==================================== - -Benchmarked version: commit 148ececb4d4259eacbb980f5992073a3ac611d82 from 31.10.2022 - -Summary -------- - -We benchmark several programs manually compiled into the primitives of -the new Juvix runtime. The code corresponds closely to the code that -will be generated by the new compilation process, with basic low-level -optimisations (unboxing, untagging, etc.) but without any high-level -optimisations on JuvixCore (inlining, specialisation, constant -folding, fusion, etc.). This corresponds to the compilation process -planned for the 0.4 milestone. - -We compare the running time and memory usage with analogous programs -written in Haskell, OCaml, JuvixCore (using the evaluator), current -Juvix (with the "direct" transpilation to C) and C. - -The results suggest that for most first-order programs the new -compilation process will produce code with running time comparable to -the code produced by the native OCaml compiler. For higher-order -programs heavy on closure manipulation, the results are acceptable but -noticeably worse, especially with third-order functions -(i.e. functions which take functions taking functions). This could, -however, be alleviated by implementing the specialisation optimisation -(see the "specialised" column in the `ackermann` and `mapfun` -benchmarks). Besides, functional programs of order higher than two are -rare. - -The comparisons with OCaml and Haskell were not entirely fair because -the new Juvix runtime does not perform garbage collection. The -overhead of garbage collection is particularly visible on the -`mergesort` benchmark which creates many intermediate data structures -that are quickly discarded. With proper memory management, the running -time results on first-order programs for the new Juvix runtime are -expected to become slightly worse than for the native OCaml compiler. - -For simple programs operating on integers which don't require any heap -memory allocation (`fibonacci` and `combinations` benchmarks), the -direct transpilation to C in the current Juvix seems to perform best -(behind only C). The reason is that for very simple programs `clang` -can better optimise the output of such a direct transpiler. The main -problem with the transpilation to C approach is that it cannot scale -to reliably work for more complex programs, as evidenced by the -segfaults, longer running time and higher memory use on other -benchmarks. - -In addition to the `fibonacci` and `combinations` benchmarks, the -advantage of direct transpilation for very simple programs is also -visible on the `fold` benchmark where a simple loop over a list -dominates the running time. However, this is partly because the -compilation of closures in current Juvix is incorrect allowing it -to be more efficient. - -Benchmark programs ------------------- - -* fibonacci: compute the Nth Fibonacci number modulo 2^28 (N = 100’000’000) - - The Nth Fibonacci number is computed in O(N). Needs only constant - stack space and no heap memory. This benchmark tests the - efficiency of tail recursion and arithmetic operations. - -* combinations: count combinations of numbers 1 to N having sum N (N = 100) - - This benchmark tests the efficiency of general recursion. No heap - memory needs to be allocated. Uses stack space proportional to - N. The running time is exponential in N. - -* prime: compute the Nth prime (N = 16384) - - The Nth prime number is computed via the Eratosthenes sieve. A - list of N primes is created. No intermediate lists are discarded - (garbage collection not needed). This benchmark tests the - efficiency of tail recursion, arithmetic operations, list cell - allocation and access. - -* mergesort: merge sort a list of N integers (N = 2’000’000) - - At each level of merge sort intermediate lists are created and - discarded. The running time for this benchmark largely depends on - the efficiency of memory management. Here one may observe the - overhead of garbage collection or the memory blow-up if no garbage - collection is used. - -* maybe: optionally sum N integers from a binary tree K times (N = 2^20, K = 100) - - If a fixed number k is encountered in the tree then the result is - `Nothing`, otherwise it is `Just sum`. The computation is repeated - for values of k from 0 to K. This tests the efficiency of handling - optional values and data structure access. - -* fold: fold a list of N integers K times (N = 100’000, K = 1000) - - The sum of N natural numbers is computed via fold_left - (tail-recursive). The computation is repeated K times. The list is - created only once, so that allocation time does not dominate. This - benchmark tests the efficiency of closure call and list cell - access. - -* cps: compute the Nth Fibonacci number modulo 2^28 with CPS (N = 100’000’000) - - The function computing the Nth Fibonacci number is written in - continuation-passing style, tail-recursively calling a - continuation supplied as an argument. This benchmark tests the - efficiency of closure call and allocation. - -* mapfold: map and fold a list of N integers K times (N = 10000, K = 10000) - - This benchmark tests the efficiency of standard higher-order - functions on lists, closure call and memory management. The - program allocates O(K) intermediate lists of length N which are - quickly discarded. - -* ackermann: compute Ack(3, N) with the higher-order Ackermann function definition (N = 11) - - The higher-order Ackermann function definition iterates an - iteration of function compositions. Hence, it uses a third-order - invocation of an iteration function. This benchmark tests the - efficiency of creating and calling second-order closures, and of - partial application. - -* mapfun: successively map K functions to a list of N integers (K = 100, N = 10000) - - The benchmark stores K second-order closures in a list, maps them - successively to a list of K closures, and then successively maps - the K closures from the result to a list of N integers. This - benchmark tests the efficiency of manipulating closures and - storing them in data structures. - -The benchmark programs can be found in `tests/benchmark` in the Juvix -source directory. - -Methodology ------------ - -For each program the total running time (elapsed real time) and memory -use (maximum resident set size) were measured on an M1 iMac with no -significant background activity. Averages of several runs were taken. -The variance was negligible, unless indicated otherwise by providing a -range. - -Results -------- - -* fibonacci: compute the Nth Fibonacci number modulo 2^28 (N = 100’000’000) - -| |New Juvix runtime (native)|New Juvix runtime (wasm32, wasmer)|Current Juvix (native)|Current Juvix (wasm32, wasmer)|JuvixCore evaluator|Haskell (native, ghc -O2)|Haskell (native, ghc -XStrict -O2)|OCaml (native, ocamlopt -O2)|OCaml (bytecode)|C (native, clang -O3)|C (wasm32, clang -Os, wasmer)| -|------------------------|--------------------------|----------------------------------|----------------------|------------------------------|-------------------|-------------------------|----------------------------------|----------------------------|----------------|---------------------|-----------------------------| -|Time (seconds, real) |0.26 |0.35 |0.35 |0.23 |13.15 |10.03 |0.39 |0.35 |0.94 |0.16 |0.22 | -|Memory use (MB, max RSS)|1.5 |3.8 |1.3 |8.8 |21.3 |8067.7 |9.7 |1.7 |1.8 |1.3 |4.0 | - -* combinations: count all combinations of numbers 1 to N having sum N (N = 1000) - -| |New Juvix runtime (native)|New Juvix runtime (wasm32, wasmer)|Current Juvix (native)|Current Juvix (wasm32, wasmer)|JuvixCore evaluator|Haskell (native, ghc -O2)|Haskell (native, ghc -XStrict -O2)|OCaml (native, ocamlopt -O2)|OCaml (bytecode)|C (native, clang -O3)|C (wasm32, clang -Os, wasmer)| -|------------------------|--------------------------|----------------------------------|----------------------|------------------------------|-------------------|-------------------------|----------------------------------|----------------------------|----------------|---------------------|-----------------------------| -|Time (seconds, real) |6.67 |11.25 |3.22 |5.1 |441.71 |5.48 |5.48 |6.53 |41.08 |2.69 |4.80 | -|Memory use (MB, max RSS)|1.5 |3.9 |1.3 |8.9 |22.3 |9.6 |9.6 |1.7 |1.9 |1.3 |4.0 | - - -* prime: compute the Nth prime (N = 16384) - -| |New Juvix runtime (native)|New Juvix runtime (wasm32, wasmer)|Current Juvix (native)|Current Juvix (wasm32, wasmer)|JuvixCore evaluator|Haskell (native, ghc -O2)|Haskell (native, ghc -XStrict -O2)|OCaml (native, ocamlopt -O2)|OCaml (bytecode)|C (native, clang -O3)|C (wasm32, clang -Os, wasmer)| -|------------------------|--------------------------|----------------------------------|----------------------|------------------------------|-------------------|-------------------------|----------------------------------|----------------------------|----------------|---------------------|-----------------------------| -|Time (seconds, real) |1.52 |1.91 |segfault |3.09 |167.04 |3.85 |3.85 |1.68 |14.82 |0.12 |0.13 | -|Memory use (MB, max RSS)|1.7 |4.0 |segfault |9.3 |24.4 |9.8 |9.6 |2.2 |2.2 |1.4 |4.0 | - - -* mergesort: merge sort a list of N integers (N = 2’000’000) - -| |New Juvix runtime (native)|New Juvix runtime (wasm32, wasmer)|Current Juvix (native)|Current Juvix (wasm32, wasmer)|JuvixCore evaluator|Haskell (native, ghc -O2)|Haskell (native, ghc -XStrict -O2)|OCaml (native, ocamlopt -O2)|OCaml (bytecode)|C (native, clang -O3)|C (wasm32, clang -Os, wasmer)| -|------------------------|--------------------------|----------------------------------|----------------------|------------------------------|-------------------|-------------------------|----------------------------------|----------------------------|----------------|---------------------|-----------------------------| -|Time (seconds, real) |0.40 |0.31 |3.55 |1.32 |22.45 |2.86 |2.90 |1.95 |3.52 |0.15 |0.15 | -|Memory use (MB, max RSS)|1973.7 |720.4 |5046.7 |2729.8 |1728.9 |253.6 |253.6 |172.6 |343.1 |24.4 |26.8 | - - -* maybe: optionally sum N non-zero integers from a binary tree K times (N = 2^20, K = 100) - -| |New Juvix runtime (native)|New Juvix runtime (wasm32, wasmer)|Current Juvix (native)|Current Juvix (wasm32, wasmer)|JuvixCore evaluator|Haskell (native, ghc -O2)|Haskell (native, ghc -XStrict -O2)|OCaml (native, ocamlopt -O2)|OCaml (bytecode)|C (native, clang -O3)|C (wasm32, clang -Os, wasmer)| -|------------------------|--------------------------|----------------------------------|----------------------|------------------------------|-------------------|-------------------------|----------------------------------|----------------------------|----------------|---------------------|-----------------------------| -|Time (seconds, real) |0.45 |0.64 |3.29 |1.57 |22.75 |5.58 |0.59 |0.30 |3.57 |0.27 |0.50 | -|Memory use (MB, max RSS)|1.6 |3.8 |2646.1 |1320.9 |22.4 |5560.7 |9.7 |3.9 |4.0 |1.3 |4.1 | - -* fold: fold a list of N integers K times (N = 100’000, K = 1000) - -| |New Juvix runtime (native)|New Juvix runtime (wasm32, wasmer)|Current Juvix (native)|Current Juvix (wasm32, wasmer)|JuvixCore evaluator|Haskell (native, ghc -O2)|Haskell (native, ghc -XStrict -O2)|OCaml (native, ocamlopt -O2)|OCaml (bytecode)|C (native, clang -O3)|C (wasm32, clang -Os, wasmer)| -|------------------------|--------------------------|----------------------------------|----------------------|------------------------------|-------------------|-------------------------|----------------------------------|----------------------------|----------------|---------------------|-----------------------------| -|Time (seconds, real) |0.45 |0.54 |0.35 |0.23 |15.27 |0.58 |0.58 |0.36 |1.80 |NA |NA | -|Memory use (MB, max RSS)|3.1 |4.6 |4.4 |10.6 |43.4 |12.7 |12.7 |5.9 |5.9 |NA |NA | - - -* cps: compute the Nth Fibonacci number modulo 2^28 with CPS (N = 100’000’000) - -| |New Juvix runtime (native)|New Juvix runtime (wasm32, wasmer)|Current Juvix (native)|Current Juvix (wasm32, wasmer)|JuvixCore evaluator|Haskell (native, ghc -O2)|Haskell (native, ghc -XStrict -O2)|OCaml (native, ocamlopt -O2)|OCaml (bytecode)|C (native, clang -O3)|C (wasm32, clang -Os, wasmer)| -|------------------------|--------------------------|----------------------------------|----------------------|------------------------------|-------------------|-------------------------|----------------------------------|----------------------------|----------------|---------------------|-----------------------------| -|Time (seconds, real) |0.43 |0.52 |1.56 |stack overflow |20.22 |10.04 |0.39 |0.35 |1.60 |0.16 |0.25 | -|Memory use (MB, max RSS)|1.5 |3.9 |1539.3 |stack overflow |21.3 |8067.7 |9.7 |1.7 |1.8 |1.3 |4.0 | - -* mapfold: map and fold a list of N integers K times (N = 10000, K = 10000) - -| |New Juvix runtime (native)|New Juvix runtime (wasm32, wasmer)|Current Juvix (native)|Current Juvix (wasm32, wasmer)|JuvixCore evaluator|Haskell (native, ghc -O2)|Haskell (native, ghc -XStrict -O2)|OCaml (native, ocamlopt -O2)|OCaml (bytecode)|C (native, clang -O3)|C (wasm32, clang -Os, wasmer)| -|------------------------|--------------------------|----------------------------------|----------------------|------------------------------|-------------------|-------------------------|----------------------------------|----------------------------|----------------|---------------------|-----------------------------| -|Time (seconds, real) |1.01 |1.59 |2.74 |1.81 |38.24 |1.29 |2.42 |1.43 |4.22 |NA |NA | -|Memory use (MB, max RSS)|2154.5 |893.0 |3059.1 |1542.0 |26.4 |10.6 |10.7 |7.5 |10-20 |NA |NA | - -* ackermann: compute Ack(3, N) with the higher-order Ackermann function definition (N = 11) - -| |New Juvix runtime (native)|New Juvix runtime (wasm32, wasmer)|New Juvix runtime (specialised, native)|New Juvix runtime (specialised, wasm32, wasmer)|Current Juvix (native)|Current Juvix (wasm32, wasmer)|JuvixCore evaluator|Haskell (native, ghc -O2)|Haskell (native, ghc -XStrict -O2)|OCaml (native, ocamlopt -O2)|OCaml (bytecode)|C (native, clang -O3)|C (wasm32, clang -Os, wasmer)| -|------------------------|--------------------------|----------------------------------|---------------------------------------|-----------------------------------------------|----------------------|------------------------------|-------------------|-------------------------|----------------------------------|----------------------------|----------------|---------------------|-----------------------------| -|Time (seconds, real) |0.92 |1.21 |0.30 |0.65 |segfault |runtime error |11.71 |0.87 |0.47 |0.54 |1.35 |0.00 |0.14 | -|Memory use (MB, max RSS)|2.6 |4.1 |2.3 |3.9 |segfault |runtime error |23.3 |13.6 |9.6 |2.0 |3.6 |1.3 |4.0 | - -* mapfun: successively map K functions to a list of N integers (K = 100, N = 10000) - -| |New Juvix runtime (native)|New Juvix runtime (wasm32, wasmer)|New Juvix runtime (specialised, native)|New Juvix runtime (specialised, wasm32, wasmer)|Current Juvix (native)|Current Juvix (wasm32, wasmer)|JuvixCore evaluator|Haskell (native, ghc -O2)|Haskell (native, ghc -XStrict -O2)|OCaml (native, ocamlopt -O2)|OCaml (bytecode)|C (native, clang -O3)|C (wasm32, clang -Os, wasmer)| -|------------------------|--------------------------|----------------------------------|---------------------------------------|-----------------------------------------------|----------------------|------------------------------|-------------------|-------------------------|----------------------------------|----------------------------|----------------|---------------------|-----------------------------| -|Time (seconds, real) |1.27 |1.04 |0.39 |0.46 |segfault |runtime error |4.18 |1.85 |0.95 |0.19 |0.68 |NA |NA | -|Memory use (MB, max RSS)|3209.8 |1229.7 |21.8 |13.2 |segfault |runtime error |33.0 |13.6 |11.6 |5.3 |7.9 |NA |NA | - -Comments --------- -* "New Juvix runtime" denotes C programs written using the primitives - of the new Juvix runtime. These programs were "manually" compiled - from the corresponding Juvix/JuvixCore programs, according to the - new Juvix compilation concept. They correspond closely to the code - that will be generated by the basic version of the new compilation - process, without any high-level optimisations (inlining, - specialisation, fusion, constant folding) but with basic low-level - memory representation optimisations (unboxing, untagging, etc). This - version of the new compilation process should be finished with the - 0.4 milestone. -* The "specialised" column for "New Juvix runtime" denotes a version - of the corresponding "New Juvix runtime" benchmark program for which - specialisation of higher-order functions was manually performed (to - simulate the effects of the high-level specialisation optimisation). -* "Current Juvix" denotes Juvix programs compiled with the current - compilation process via a "direct" translation to C. For a fair - comparison, all number operations were implemented using native - binary C integers (exposed via `foreign` and `compile` blocks) - without overflow check, instead of using the unary Nat from the - standard library. For Haskell, we use the fixed-precision Int - instead of the arbitrary-precision Integer. -* For the simplest benchmark programs without heap memory allocation - (e.g. `fibonacci`, `combinations`), the performance of "Current - Juvix" is comparable to or better than that of "New Juvix - runtime". This is because `clang` managed to eliminate (tail) - recursion and optimise the code to essentially the same or better - thing. The main problem with the current "direct" transpilation to C - approach is that it cannot scale to reliably work for more complex - programs. By "more complex" I mean larger program size, more - functions, more complex patterns of recursion and/or the use of more - functional programming features (including functional data - structures). I don't mean higher computational complexity or more - resource use. -* The segfaults and runtime errors for "Current Juvix" are - consequences of incorrectly generated code (current compilation of - partial application is not entirely correct) or stack overflows - (when `clang` didn't figure out how to eliminate tail recursion). -* The comparison with "Current Juvix" is not entirely fair for - benchmarks that test the manipulation and calling of closures - (e.g. `fold`). Current Juvix achieves good performance (when it - doesn't segfault) at the expense of correctness: partial application - is not compiled correctly and fixing this would require a - fundamental change in closure representation. -* The comparison with Haskell and OCaml compilers is not entirely - fair, because the new Juvix runtime does not perform garbage - collection. With the GC overhead, I would expect the Juvix runtime - results for native compilation of first-order programs to become a - bit worse than the native OCaml versions. The GC overhead is - particularly noticeable for the `mergesort` benchmark which creates - many large intermediate lists. The memory usage of the Juvix runtime - is much higher on this benchmark than the memory usage of OCaml or - Haskell versions. The relatively small time difference between the - OCaml native and bytecode versions of `mergesort` also indicates - that GC accounts for a significant part of the running time. -* Another small overhead will be introduced by bounds checking for - integer operations. Currently, the new Juvix runtime operates on - unboxed 31-bit (or 63-bit) integers without checking for integer - overflow. -* If we decide to default to transparent arbitrary-precision integers, - then another small overhead will be introduced by the need to check - the integer representation with each arithmetic operation. -* Admittedly, the programs were deliberately written in a way to make - high-level optimisations unnecessary, except specialisation for - higher-order functions (mostly in `ackermann` and `mapfun`). This - also explains the good performance of the OCaml native compiler - which doesn't do much high-level optimisation. -* In the "Current Juvix" and OCaml version of `mergesort`, to avoid - stack overflow the `merge` function was written tail-recursively - with accumulator reversal at the end. This is not necessary for the - new Juvix runtime, because the stack is dynamically extended when - needed. -* As evidenced by the `combinations` benchmark, for non-tail-recursive - direct calls our code performs worse than the code which uses the C - / WebAssembly stack and function call mechanisms. However, in - general it is impossible to directly use the C / WebAssembly stack - and call mechanisms for a purely functional language. Since we - dynamically allocate the stack segments when needed, stack overflow - is impossible. This is convenient in an eager functional - language. Otherwise, one needs to rewrite all functions operating on - large data to use tail recursion. We pay for this convenience with a - small overhead, which is the main reason for poorer performance on - `combinations` where stack manipulation cost dominates. -* Haskell's laziness seems to introduce more overhead than I - expected. This would explain the comparatively better performance of - the native OCaml compiler. The problem is particularly stark when - Haskell's strictness analysis fails for some reason, as in the - `fibonacci` benchmark. The second "Haskell" column with the - "-XStrict" flag for GHC indicates the version of the benchmark - compiled with strictness as the default. -* The C versions of the programs were written to take advantage of C's - imperative features, e.g., using arrays instead of lists, loops - instead of recursion. No C versions are provided for some benchmarks - designed to test specifically functional language features. -* With the new Juvix runtime, the 32-bit WebAssembly version of - `mergesort` is faster than the 64-bit native version because it - needs roughly half as much memory (the word size is 4 bytes instead - of 8). The difference is even starker between the WebAssembly and - native versions of `mergesort` for "Current Juvix". -* There seems to be a memory leak in the JuvixCore evaluator. This is - what happens too often when one uses a lazy language. -* Haskell also leaks memory in the Fibonacci benchmark, despite it - being a simple tail-recursive program. It seems strictness analysis - didn't work. diff --git a/docs/org/notes/strictly-positive-data-types.org b/docs/org/notes/strictly-positive-data-types.org deleted file mode 100644 index 4419e1840..000000000 --- a/docs/org/notes/strictly-positive-data-types.org +++ /dev/null @@ -1,71 +0,0 @@ -* Strictly positive data types - -We follow a syntactic description of strictly positive inductive data types. - -An inductive type is said to be _strictly positive_ if it does not occur or -occurs strictly positively in the types of the arguments of its constructors. A -name qualified as strictly positive for an inductive type if it never occurs at -a negative position in the types of the arguments of its constructors. We refer -to a negative position as those occurrences on the left of an arrow in a type -constructor argument. - -In the example below, the type =X= occurs strictly positive in =c0= and -negatively at the constructor =c1=. Therefore, =X= is not strictly positive. - -#+begin_src minijuvix -axiom B : Type; -type X := - c0 : (B -> X) -> X - | c1 : (X -> X) -> X; -#+end_src - -We could also refer to positive parameters as such parameters occurring in no -negative positions. For example, the type =B= in the =c0= constructor above is -on the left of the arrow =B->X=. Then, =B= is at a negative position. Negative -parameters need to be considered when checking strictly positive data types as -they may allow to define non-strictly positive data types. - -In the example below, the type =T0= is strictly positive. However, the type =T1= is not. -Only after unfolding the type application =T0 (T1 A)= in the data constructor =c1=, we can -find out that =T1= occurs at a negative position because of =T0=. More precisely, -the type parameter =A= of =T0= is negative. - -#+begin_src minijuvix -type T0 (A : Type) := c0 : (A -> T0 A) -> T0 A; - -type T1 := c1 : T0 T1 -> T1; -#+end_src - - -** Bypass the strict positivity condition - -To bypass the positivity check, a data type declaration can be annotated -with the keyword =positive=. Another way is to use the CLI global flag =--no-positivity= -when typechecking a =Juvix= File. - -#+begin_example -$ cat tests/negative/MicroJuvix/NoStrictlyPositiveDataTypes/E5.mjuvix -module E5; - positive - type T0 (A : Type) := - c0 : (T0 A -> A) -> T0 A; -end; -#+end_example - -** Examples of non-strictly data types - -- =Bad= is not strictly positive beceause of the negative parameter =A= of =Tree=. - #+begin_src minijuvix - type Tree (A : Type) := - leaf : Tree A - | node : (A -> Tree A) -> Tree A; - - type Bad := - bad : Tree Bad -> Bad; - #+end_src - -- =A= is a negative parameter. - #+begin_src minijuvix - type B (A : Type) := - b : (A -> B (B A -> A)) -> B A; - #+end_src diff --git a/docs/org/reference/examples.org b/docs/org/reference/examples.org deleted file mode 100644 index a071f86ed..000000000 --- a/docs/org/reference/examples.org +++ /dev/null @@ -1,8 +0,0 @@ -The following links are clickable versions of their corresponding Juvix programs. The HTML output is generated by running =juvix html --recursive FileName.juvix=. - -- [[https://docs.juvix.org/examples/html/HelloWorld/HelloWorld.html][HelloWorld.juvix]] -- [[https://docs.juvix.org/examples/html/Fibonacci/Fibonacci.html][Fibonacci.juvix]] -- [[https://docs.juvix.org/examples/html/Hanoi/Hanoi.html][Hanoi.juvix]] -- [[https://docs.juvix.org/examples/html/PascalsTriangle/PascalsTriangle.html][PascalsTriangle.juvix]] -- [[https://docs.juvix.org/examples/html/Collatz/Collatz.html][Collatz.juvix]] -- [[https://docs.juvix.org/examples/html/TicTacToe/CLI/CLI.TicTacToe.html][TicTacToe.juvix]] diff --git a/docs/org/reference/language/README.org b/docs/org/reference/language/README.org deleted file mode 100644 index 6a2e01627..000000000 --- a/docs/org/reference/language/README.org +++ /dev/null @@ -1,7 +0,0 @@ - - [[./functions.md][Functions]] - - [[./datatypes.md][Data types]] - - [[./modules.md][Modules]] - - [[./let.md][Local definitions]] - - [[./control.md][Control structures]] - - [[./comments.md][Comments]] - - [[./axioms.md][Axioms]] diff --git a/docs/org/reference/language/axioms.org b/docs/org/reference/language/axioms.org deleted file mode 100644 index 25373b680..000000000 --- a/docs/org/reference/language/axioms.org +++ /dev/null @@ -1,15 +0,0 @@ -* Axiom - -Axioms or postulates can be introduced by using the =axiom= keyword. -For example, let us imagine one wants to write a program that assumes -$A$ is a type, and there exists a term $x$ that inhabits $A$. Then the program would look like the following. - -#+begin_src --- Example.juvix -module Example; - axiom A : Type; - axiom x : A; -end; -#+end_src - -Terms introduced by the =axiom= keyword lack any computational content. Programs containing axioms not marked as builtins cannot be compiled to most targets. diff --git a/docs/org/reference/language/builtins.org b/docs/org/reference/language/builtins.org deleted file mode 100644 index 29a65ee39..000000000 --- a/docs/org/reference/language/builtins.org +++ /dev/null @@ -1,30 +0,0 @@ - -* Built-ins - -Juvix has support for the built-in natural type and a few functions that are compiled to efficient primitives. - -1. Built-in inductive definitions. - - #+begin_example - builtin nat - type Nat := - zero : Nat | - suc : Nat → Nat; - #+end_example - -2. Builtin function definitions. - - #+begin_example - infixl 6 +; - builtin nat-plus - + : Nat → Nat → Nat; - + zero b := b; - + (suc a) b := suc (a + b); - #+end_example - -3. Builtin axiom definitions. - - #+begin_example - builtin nat-print - axiom printNat : Nat → Action; - #+end_example diff --git a/docs/org/reference/language/comments.org b/docs/org/reference/language/comments.org deleted file mode 100644 index f379953ed..000000000 --- a/docs/org/reference/language/comments.org +++ /dev/null @@ -1,17 +0,0 @@ -* Comments - -Comments follow the same syntax as in =Haskell= and =Agda=. Be aware, Juvix has no support for nested comments. - -- Inline Comment -#+begin_src --- This is a comment! -#+end_src - -- Region comment - -#+begin_src -{- - This is a comment! - --} -#+end_src diff --git a/docs/org/reference/language/control.org b/docs/org/reference/language/control.org deleted file mode 100644 index 6e4f2cae1..000000000 --- a/docs/org/reference/language/control.org +++ /dev/null @@ -1,27 +0,0 @@ -* Control structures - -** Case - -A case expression has the following syntax: - -#+begin_example -case value -| pat1 := branch1 -.. -| patN := branchN -#+end_example - -For example, one can evaluate the following expression in the REPL: -#+begin_example -Stdlib.Prelude> case 2 | zero := 0 | suc x := x | _ := 19 -1 -#+end_example - -** Lazy builtins - -The standard library provides several builtin functions which are treated specially and evaluated lazily. These builtins must always be fully applied. - -- =if condition branch1 branch2=. First evaluates =condition=, if true evaluates and returns =branch1=, otherwise evaluates and returns =branch2=. -- =a || b=. Lazy disjunction. First evaluates =a=, if true returns true, otherwise evaluates and returns =b=. -- =a && b=. Lazy conjunction. First evaluates =a=, if false returns false, otherwise evaluates and returns =b=. -- =a >> b=. Sequences two IO actions. Lazy in the second argument. diff --git a/docs/org/reference/language/datatypes.org b/docs/org/reference/language/datatypes.org deleted file mode 100644 index 54a4ba3dd..000000000 --- a/docs/org/reference/language/datatypes.org +++ /dev/null @@ -1,50 +0,0 @@ -* Data types - -A data type declaration consists of: -- the =type= keyword, -- a unique name for the type, -- the =:== symbol, -- a non-empty list of constructor declarations -- functions for building the elements of the data type. - -The simplest data type is the =Unit= type with one constructor called =unit=. - -#+begin_example -type Unit := unit : Unit; -#+end_example - -In the following example, we declare the type =Nat= -- the unary -representation of natural numbers. This type comes with two constructors: =zero= and =suc=. Example elements of type =Nat= are the number one represented -by =suc zero=, the number two represented by =suc (suc zero)=, etc. - -#+begin_example -type Nat := - zero : Nat - | suc : Nat -> Nat; -#+end_example - -Constructors can be used like normal functions or in patterns when defining functions by pattern matching. For example, here is a function adding two natural numbers: - -#+begin_src text -infixl 6 +; -+ : Nat -> Nat -> Nat; -+ zero b := b; -+ (suc a) b := suc (a + b); -#+end_src - -A data type may have type parameters. A data type with a type -parameter =A= is called /polymorphic in/ =A=. A canonical example is -the type =List= polymorphic in the type of list elements. - -#+begin_example -infixr 5 ::; -type List (A : Type) := - nil : List A - | :: : A -> List A -> List A; - -elem : {A : Type} -> (A -> A -> Bool) -> A -> List A -> Bool; -elem _ _ nil := false; -elem eq s (x :: xs) := eq s x || elem eq s xs; -#+end_example - -For more examples of inductive types and how to use them, see -[[https://anoma.github.io/juvix-stdlib/][the Juvix standard library]]. diff --git a/docs/org/reference/language/functions.org b/docs/org/reference/language/functions.org deleted file mode 100644 index 6e9c3d18d..000000000 --- a/docs/org/reference/language/functions.org +++ /dev/null @@ -1,88 +0,0 @@ -* Function declarations - -A function declaration consists of a type signature and a group of /function clauses/. - -In the following example, we define a function =multiplyByTwo=. The first -line =multiplyByTwo : Nat -> Nat;= is the type signature and the second line -~multiplyByTwo n := 2 * n;~ is a function clause. - -#+begin_example -open import Stdlib.Prelude; - -multiplyByTwo : Nat -> Nat; -multiplyByTwo n := 2 * n; -#+end_example - -A function may have more than one function clause. When a function is called, -the first clause that matches the arguments is used. - -The following function has two clauses. - -#+begin_example -open import Stdlib.Prelude; - -neg : Bool -> Bool; -neg true := false; -neg false := true; -#+end_example - -When =neg= is called with =true=, the first clause is used and the function -returns =false=. Similarly, when =neg= is called with =false=, the second clause -is used and the function returns =true=. - -** Mutually recursive functions - -Function declarations can depend on each other recursively. In the following example, we define a function that checks if a number is =even= by calling a function that checks if a number is =odd=. - -#+begin_example -open import Stdlib.Prelude; - -odd : Nat -> Bool; -even : Nat -> Bool; - -odd zero := false; -odd (suc n) := even n; - -even zero := true; -even (suc n) := odd n; -#+end_example - -** Anonymous functions - -Anonymous functions, or /lambdas/, are introduced with the syntax: - -#+begin_example -\{| pat1 .. patN_1 := clause1 - | .. - | pat1 .. patN_M := clauseM} -#+end_example - -The first pipe =|= is optional. Instead of =\= one can also use =λ=. - -An anonymous function just lists all clauses of a function without -naming it. Any function declaration can be converted to use anonymous -functions: - -#+begin_example -open import Stdlib.Prelude; - -odd : Nat -> Bool; -even : Nat -> Bool; - -odd := \{ - | zero := false - | (suc n) := even n -}; - -even := \{ - | zero := true - | (suc n) := odd n -}; -#+end_example - -** Short definitions - -A function definition can be written in one line, with the body immediately following the signature: -#+begin_example -multiplyByTwo : Nat -> Nat := \{n := 2 * n}; -#+end_example diff --git a/docs/org/reference/language/let.org b/docs/org/reference/language/let.org deleted file mode 100644 index d7942f11f..000000000 --- a/docs/org/reference/language/let.org +++ /dev/null @@ -1,16 +0,0 @@ -* Local definitions - -Local definitions are introduced with the =let= construct. - -#+begin_example -sum : NList -> Nat; -sum lst := - let - go : Nat -> NList -> Nat; - go acc nnil := acc; - go acc (ncons x xs) := go (acc + x) xs; - in - go 0 lst; -#+end_example - -The declaractions in a =let= have the same syntax as declarations inside a module, but they are visible only in the expression following the =in= keyword. diff --git a/docs/org/reference/language/modules.org b/docs/org/reference/language/modules.org deleted file mode 100644 index 53005e664..000000000 --- a/docs/org/reference/language/modules.org +++ /dev/null @@ -1,173 +0,0 @@ -* Module system - -** Defining a module - -The =module= keyword stars the declaration of a module followed by its -name and body. The module declaration ends with the =end= keyword. - -#+begin_example --- ModuleName.juvix -module ModuleName; - -end; -#+end_example - -A _Juvix project_ is a collection of Juvix modules inside one main -project folder containing a metadata file named =juvix.yaml=. Each -Juvix file has to define a _module_ of the same name. The name of the -module must coincide with the path of the its file relative to its -project's root directory. For example, if the file is -=root/Data/List.juvix= then the module must be called =Data.List=, -assuming =root= is the project's folder. - -To check that Juvix is correctly detecting your project's root, one can run the -command =juvix dev root File.juvix=. - -# - Inside a module, other (sub) modules can be declared. - -# #+begin_example -# -- Example.juvix -# module Example; -# module A; -# end; -# end; -# #+end_example - -** Importing modules - -To bring into the current scope all module definitions from other external -modules, one can use the =import= keyword along with the corresponding module -name. This way, one gets all the imported names qualified. - -#+begin_example --- A.juvix -module A; - axiom Nat : Type; - axiom zero : Nat; -end; - --- B.juvix -module B; - import A; - x : A.Nat; - x := A.zero; -#+end_example - -Additionally, one can _open_ an imported module making available all its -names by their unqualified name. - -#+begin_example --- A.juvix -module A; - axiom Nat : Type; - axiom zero : Nat; -end; - --- B.juvix -module B; - import A; - open A; - x : Nat; - x := zero; -#+end_example - -However, opening modules may create name collisions if you already have the -imported names as definitions in the current module. In this case, Juvix will -complain with an error, letting you know which symbols are ambiguous. For -example, in module =B= below, the name =a= is ambiguous. - -#+begin_example --- A.juvix -module A; -axiom A : Type; -axiom a : A; -end; - --- B.juvix -module B; -import A; -open A; -axiom a : A; - -x := a; -end; -#+end_example - -One alternative here is hiding the name =a= as follows. - -#+begin_example --- B.juvix -module B; -import A; -open A hiding {a}; - -axiom a : A; -x := a; - -end; -#+end_example - -Now, we can use the =open import= syntax to simplify the =import-open= statements. - -Instead of having: - -#+begin_example -import Prelude; -open Prelude; -#+end_example - -We simplify it by the expression: - -#+begin_example -open import Prelude; -#+end_example - -The =hiding= keyword can be used within an =open-import= statement. - -#+begin_example --- B.juvix -module A; -open import A hiding {a}; -axiom a : A; -x := a; -end; -#+end_example - -** Exporting symbols - -The module =C= below does not typecheck. Both symbols, originally defined in -module =A=, are not visible in module =C= after importing =B=. The symbols =A= -and =a= are not exported by the module =B=. To export symbols from an imported -module, one can use the =public= keyword at the end of the corresponding =open= -statement. For example, the module =C= typechecks after marking the import of =A= as -=public= in module =B=. - -#+begin_example --- A.juvix -module A; -axiom A : Type; -axiom a : A; -end; - --- B.juvix -module B; -open import A; -end; - --- C.juvix -module C; -open import B; - -x : A; -x := a; -end; -#+end_example - -Fix: - -#+begin_example --- B.juvix -module B; -open import A public; -end; -#+end_example diff --git a/docs/org/reference/stdlib.org b/docs/org/reference/stdlib.org deleted file mode 100644 index a266b3abb..000000000 --- a/docs/org/reference/stdlib.org +++ /dev/null @@ -1,2 +0,0 @@ - -The [[https://anoma.github.io/juvix-stdlib/][Juvix standard library]] contains common functions that can be used in Juvix programs. diff --git a/docs/org/reference/tooling/CLI.org b/docs/org/reference/tooling/CLI.org deleted file mode 100644 index d540b0584..000000000 --- a/docs/org/reference/tooling/CLI.org +++ /dev/null @@ -1,106 +0,0 @@ -* CLI - -** Usage - -#+begin_src shell -juvix [Global options] ((-v|--version) | (-h|--help) | COMPILER_CMD | UTILITY_CMD) -#+end_src - -** Informative options - -- =-v,--version= - Print the version and exit -- =-h,--help= - Show this help text - - -** Global Command flags - -- =--no-colors= - Disable globally ANSI formatting -- =--show-name-ids= - Show the unique number of each identifier when pretty - printing -- =--only-errors= - Only print errors in a uniform format (used by - juvix-mode) -- =--no-termination= - Disable termination checking -- =--no-positivity= - Disable positivity checking for inductive types -- =--no-stdlib= - Do not use the standard library - -** Main Commands - -- =html= - Generate HTML output from a Juvix file -- =typecheck= - Typecheck a Juvix file -- =compile= - Compile a Juvix file - -** Utility Commands - -- =doctor= - Perform checks on your Juvix development environment -- =init= - Interactively initialize a juvix project in the current directory - -** Dev Commands - -#+begin_src shell -juvix dev COMMAND -#+end_src - -- =parse= - Parse a Juvix file -- =scope= - Parse and scope a Juvix file -- =highlight= - Highlight a Juvix file -- =core= - Subcommands related to JuvixCore -- =asm= - Subcommands related to JuvixAsm -- =root= - Show the root path for a Juvix project -- =termination= - Subcommands related to termination checking -- =internal= - Subcommands related to Internal -- =minic= - Translate a Juvix file to a subset of C - -** CLI Auto-completion Scripts - -The Juvix CLI can generate auto-completion scripts. Follow the instructions below for your shell. - -NB: You may need to restart your shell after installing the completion script. - -*** Bash - -Add the following line to your bash init script (for example =~/.bashrc=). - -#+begin_src shell - eval "$(juvix --bash-completion-script juvix)" -#+end_src - -*** Fish - -Run the following command in your shell: - -#+begin_src shell -juvix --fish-completion-script juvix - > ~/.config/fish/completions/juvix.fish -#+end_src - -*** ZSH - -Run the following command in your shell: - -#+begin_src shell -juvix --zsh-completion-script juvix > $DIR_IN_FPATH/_juvix -#+end_src - -where =$DIR_IN_FPATH= is a directory that is present on the [[https://zsh.sourceforge.io/Doc/Release/Functions.html][ZSH FPATH variable]] (which you can inspect by running =echo $FPATH= in the shell). diff --git a/docs/org/reference/tooling/README.org b/docs/org/reference/tooling/README.org deleted file mode 100644 index dd57f660b..000000000 --- a/docs/org/reference/tooling/README.org +++ /dev/null @@ -1,4 +0,0 @@ -- [[./CLI.md][Command line Interface]] -- [[./emacs.md][Emacs Mode]] -- [[./testing.md][Test Suite]] -- [[./doctor.md][Doctor]] diff --git a/docs/org/reference/tooling/doctor.org b/docs/org/reference/tooling/doctor.org deleted file mode 100644 index 6557693c5..000000000 --- a/docs/org/reference/tooling/doctor.org +++ /dev/null @@ -1,93 +0,0 @@ -* Juvix Doctor - -The =juvix doctor= command can help you to troubleshoot problems with your development environment. For each problem the doctor finds they'll be a link to a section on this page to help you fix it. - -** Could not find the clang command - -The Juvix compiler uses the [[https://clang.llvm.org][Clang compiler]] version 13 or later to generate binaries. You need to have Clang available on your system =$PATH=. - -Recommended installation method: - -*** MacOS - -Use [[https://brew.sh][Homebrew]]: - -#+begin_src shell -brew install llvm -#+end_src - -NB: The distribution of Clang that comes with XCode does not support the =Wasm= target so you must install the standard Clang distribution. - -*** Debian / Ubuntu Linux - -#+begin_src shell -sudo apt install clang lldb lld -#+end_src - -*** Arch Linux - -#+begin_src shell -sudo pacman -S llvm lld -#+end_src - -** Could not find the wasm-ld command - -The Juvix compiler required =wasm-ld= (the Wasm linker) to produce =Wasm= binaries. - -Recommended installation method: - -*** MacOS - -=wasm-ld= is included in the [[https://brew.sh][Homebrew]] llvm distribution: - -#+begin_src shell -brew install llvm -#+end_src - -*** Debian / Ubuntu Linux - -#+begin_src shell -sudo apt install lldb lld -#+end_src - -*** Arch Linux - -#+begin_src shell -sudo pacman -S lld -#+end_src - -** Newer Clang version required - -Juvix requires Clang version 13 or above. See the documentation on [[./doctor.md#could-not-find-the-clang-command][installing Clang]]. - -** Clang does not support the wasm32 target - -Juvix requires Clang version 13 or above. See the documentation on [[./doctor.md#could-not-find-the-clang-command][installing Clang]]. - -** Clang does not support the wasm32-wasi target - -Juvix uses [[https://wasi.dev][WASI - The Wasm System Interface]] to produce binaries that can be executed using a Wasm runtime. The files necessary to setup Clang with =wasm32-wasi= support are available at [[https://github.com/WebAssembly/wasi-sdk/releases][wasi-sdk]]. - -To install the =wasm32-wasi= target for Clang you need to do two things: - -*** Install =libclang_rt.builtins-wasm32.a= into your Clang distribution - -1. Obtain =libclang_rt.builtins-wasm32-wasi-16.0.tar.gz= from the [[https://github.com/WebAssembly/wasi-sdk/releases][wasi-sdk releases]] page. -2. Untar the file and place the file =lib/wasi/libclang_rt.builtins-wasm32.a= into your Clang distribution directory. - - On MacOS, if you installed llvm using homebrew you can find the Clang distribution directory using =brew --prefix llvm=. You should then place the builtins file at =`brew --prefix llvm`/lib/wasi/libclang_rt.builtins-wasm32.a=. - - On Linux the Clang distribution directory will be something like =/usr/lib/clang/13.0.1= where =13.0.1= is the version of Clang that you have installed. You should then place the builtins file at =/usr/lib/clang/13.0.1/lib/wasi/libclang_rt.builtins-wasm32=. - -*** Download the WASI sysroot and set =WASI_SYSROOT_PATH= - -1. Obtain =wasi-sysroot-16.0.tar.gz= from the [[https://github.com/WebAssembly/wasi-sdk/releases][wasi-sdk releases]] page. -2. Untar the file and set the environment variable =WASI_SYSROOT_PATH= to that location. - -** Environment variable =WASI_SYSROOT_PATH= is not set - -Set the =WASI_SYSROOT_PATH= to the directory where you installed the =wasi-sdk= sysroot files. See [[./doctor.md#download-the-wasi-sysroot-and-set-wasi_sysroot_path][installing the WASI sysroot]]. - -** Could not find the wasmer command - -The Juvix test suite uses [[https://wasmer.io][Wasmer]] as a Wasm runtime to execute compiled Wasm binaries. See [[https://docs.wasmer.io/ecosystem/wasmer/getting-started][the Wasmer documentation]] to see how to install it. diff --git a/docs/org/reference/tooling/emacs.org b/docs/org/reference/tooling/emacs.org deleted file mode 100644 index e7c67f1dd..000000000 --- a/docs/org/reference/tooling/emacs.org +++ /dev/null @@ -1,52 +0,0 @@ -** Emacs Mode - -There is an Emacs mode available for Juvix. Currently, it -supports syntax highlighting for well-scoped modules. - -To get started, clone the Juvix Emacs mode repository: - -#+begin_src sh -git clone https://github.com/anoma/juvix-mode.git -#+end_src - -To install it add the following lines to your -Emacs configuration file: - -#+begin_src elisp -(push "/path/to/juvix-mode/" load-path) -(require 'juvix-mode) -#+end_src - -Make sure that Juvix is installed in your =PATH=. - -The Juvix major mode will be activated automatically for =.juvix= files. - -*** Keybindings - - | Key | Function Name | Description | - |-----------+-------------------------+-------------------------------------------------------| - | =C-c C-l= | =juvix-load= | Runs the scoper and adds semantic syntax highlighting | - | =M-.= | =juvix-goto-definition= | Go to the definition of symbol at point | - | =C-c C-f= | =juvix-format-buffer= | Format the current buffer | - -*** Emacs installation - -Most Linux distributions contain an Emacs package which can be -installed with your package manager (=sudo apt install emacs= on -Ubuntu). On macOS, it is recommended to install Emacs Plus via -Homebrew: =brew install emacs-plus=. Using the Emacs Homebrew casks is -not recommended. - -*** Common problems - -- Error "Symbol's value as variable is void: sh:1:" - - Make sure the juvix executable is on the Emacs' =exec-path=. Note - that =exec-path= may be different from your shell's =PATH=. This is - particularly common on macOS with Emacs launched from GUI instead of - the terminal. - - The easiest way to resolve this issue is to install the - [[https://github.com/purcell/exec-path-from-shell][exec-path-from-shell]] package (available on MELPA). Alternatively, - one may set =exec-path= to match shell =PATH= by following the - instructions from [[https://www.emacswiki.org/emacs/ExecPath][EmacsWiki]]. diff --git a/docs/org/reference/tooling/testing.org b/docs/org/reference/tooling/testing.org deleted file mode 100644 index 6059ce2cf..000000000 --- a/docs/org/reference/tooling/testing.org +++ /dev/null @@ -1,20 +0,0 @@ -* Testing - -*** Dependencies - -See [[./doctor.html][Installing dependencies]] for instructions on how to setup the testing -environment for the WASM compiler tests. - -*** Running - -Run tests using: - -#+begin_src shell -stack test -#+end_src - -To run tests, ignoring all the WASM tests: - -#+begin_src shell -stack test --ta '-p "! /slow tests/"' -#+end_src diff --git a/docs/org/tutorials/README.org b/docs/org/tutorials/README.org deleted file mode 100644 index 62dd0deb5..000000000 --- a/docs/org/tutorials/README.org +++ /dev/null @@ -1 +0,0 @@ - - [[./nodejs-interop.md][NodeJS Interop]] diff --git a/docs/org/tutorials/emacs.org b/docs/org/tutorials/emacs.org deleted file mode 100644 index aff498bd3..000000000 --- a/docs/org/tutorials/emacs.org +++ /dev/null @@ -1,78 +0,0 @@ -* Juvix Emacs mode tutorial - -First, follow the instructions in the [[../reference/tooling/emacs.md][Emacs Mode Reference]] to install -the Juvix Emacs mode. Once you've successfully set it up, create a -file =Hello.juvix= with the following content. - -#+begin_example -module Hello; - -open import Stdlib.Prelude; - -main : IO; -main := printStringLn "Hello world!"; - -end; -#+end_example - -Type =C-c C-l= to run the scoper and highlight the syntax. - -If you make a mistake in your program, it is automatically underlined -in red with the error message popping up when you hover the mouse -pointer over the underlined part. - -For example, in the following program the identifier =printStringLna= -should be underlined with the error message "Symbol not in scope". - -#+begin_example -module Hello; - -open import Stdlib.Prelude; - -main : IO; -main := printStringLna "Hello world!"; - -end; -#+end_example - -If error underlining doesn't work, make sure you have the =flycheck= -mode turned on. It should be turned on automatically when loading -=juvix-mode=, but in case this doesn't work you can enable it with -=M-x flycheck-mode=. - -Let's extend our program with another definition. - -#+begin_example -module Hello; - -open import Stdlib.Prelude; - -print : IO; -print := printStringLn "Hello world!"; - -main : IO; -main := print; - -end; -#+end_example - -Place the cursor on the =print= call in the function clause of =main= -and press =M-.=. The cursor will jump to the definition of =print= -above. This also works across files and for definitions from the -standard library. You can try using =M-.= to jump to the definition of -=printStringLn=. - -One more feature of the Juvix Emacs mode is code formatting. To format -the content of the current buffer, type =C-c C-f=. Here is the result. - -#+begin_example -module Hello; - open import Stdlib.Prelude; - - print : IO; - print := printStringLn "Hello world!"; - - main : IO; - main := print; -end; -#+end_example diff --git a/docs/org/tutorials/learn.org b/docs/org/tutorials/learn.org deleted file mode 100644 index dc9816ad0..000000000 --- a/docs/org/tutorials/learn.org +++ /dev/null @@ -1,517 +0,0 @@ -* Juvix tutorial - -NOTE: This is a tutorial for Juvix version 0.3. Earlier versions do not support all of the syntax described here. - - * [[./learn.md#juvix-repl][Juvix REPL]] - * [[./learn.md#basic-expressions][Basic expressions]] - * [[./learn.md#files-modules-and-compilation][Files, modules and compilation]] - * [[./learn.md#output][Output]] - * [[./learn.md#data-types-and-functions][Data types and functions]] - * [[./learn.md#pattern-matching][Pattern matching]] - * [[./learn.md#comparisons-and-conditionals][Comparisons and conditionals]] - * [[./learn.md#local-definitions][Local definitions]] - * [[./learn.md#recursion][Recursion]] - * [[./learn.md#partial-application-and-higher-order-functions][Partial application and higher-order functions]] - * [[./learn.md#polymorphism][Polymorphism]] - * [[./learn.md#tail-recursion][Tail recursion]] - * [[./learn.md#totality-checking][Totality checking]] - * [[./learn.md#exercises][Exercises]] - -** Juvix REPL - -After [[../howto/installing.md][installing Juvix]], launch the Juvix REPL: - -#+begin_src shell -juvix repl -#+end_src - -The response should be similar to: -#+begin_example -Juvix REPL version 0.3: https://juvix.org. Run :help for help -OK loaded: ./.juvix-build/stdlib/Stdlib/Prelude.juvix -Stdlib.Prelude> -#+end_example - -Currently, the REPL supports evaluating expressions but it does not yet support adding new definitions. To see the list of available REPL commands type =:help=. - -** Basic expressions - -You can try evaluating simple arithmetic expressions in the REPL: -#+begin_example -Stdlib.Prelude> 3 + 4 -7 -Stdlib.Prelude> 1 + 3 * 7 -22 -Stdlib.Prelude> div 35 4 -8 -Stdlib.Prelude> mod 35 4 -3 -Stdlib.Prelude> sub 35 4 -31 -Stdlib.Prelude> sub 4 35 -0 -#+end_example -By default Juvix operates on nonnegative natural numbers. Natural number subtraction is implemented by the function =sub=. Subtracting a bigger natural number from a smaller one yields =0=. - -You can also try boolean expressions -#+begin_example -Stdlib.Prelude> true -true -Stdlib.Prelude> not true -false -Stdlib.Prelude> true && false -false -Stdlib.Prelude> true || false -true -Stdlib.Prelude> if true 1 0 -1 -#+end_example -and strings, pairs and lists: -#+begin_example -Stdlib.Prelude> "Hello world!" -"Hello world!" -Stdlib.Prelude> (1, 2) -(1, 2) -Stdlib.Prelude> 1 :: 2 :: nil -1 :: 2 :: nil -#+end_example - -In fact, you can use all functions and types from the [[https://anoma.github.io/juvix-stdlib/Stdlib.Prelude.html][Stdlib.Prelude]] module of the [[https://anoma.github.io/juvix-stdlib][standard library]], which is preloaded by default. - -#+begin_example -Stdlib.Prelude> length (1 :: 2 :: nil) -3 -Stdlib.Prelude> null (1 :: 2 :: nil) -false -Stdlib.Prelude> swap (1, 2) -(2, 1) -#+end_example - -** Files, modules and compilation - -Currently, the REPL does not support adding new definitions. To define new functions or data types, you need to put them in a separate file and either load the file in the REPL with =:load file.juvix= or compile the file to a binary executable with the shell command =juvix compile file.juvix=. - -To conveniently edit Juvix files, an [[./emacs.md][Emacs mode]] and a [[./vscode.md][VSCode extension]] are available. - -A Juvix file must declare a module whose name corresponds exactly to the name of the file. For example, a file =Hello.juvix= must declare a module =Hello=: -#+begin_example --- Hello world example. This is a comment. -module Hello; - --- Import the standard library prelude, including the function 'printStringLn' -open import Stdlib.Prelude; - -main : IO; -main := printStringLn "Hello world!"; - -end; -#+end_example -A file compiled to an executable must define the zero-argument function =main= of type =IO= which is evaluated when running the program. - -** Output - -In addition to =printStringLn=, the standard library includes the functions =printString=, =printNat=, =printNatLn=, =printBool=, =printBoolLn=. The =IO= computations can be sequenced with =>>=, e.g., -#+begin_example -printNat 3 >> printString " + " >> printNatLn 4 -#+end_example -has type =IO= and when executed prints =3 + 4= followed by a newline. - -The type =IO= is the type of IO actions, i.e., of data structures representing IO computations. The functions =printString=, =printNat=, etc., do not immediately print their arguments, but rather create a data structure representing an appropriate IO action. The IO actions created by the =main= function are executed only after the program has been evaluated. - -** Data types and functions - -To see the type of an expression, use the =:type= REPL command: -#+begin_example -Stdlib.Prelude> :type 1 -Nat -Stdlib.Prelude> :type true -Bool -#+end_example - -The types =Nat= and =Bool= are defined in the standard library. - -The type =Bool= has two constructors =true= and =false=. -#+begin_example -type Bool := -| true : Bool -| false : Bool; -#+end_example -The constructors of a data type can be used to build elements of the type. They can also appear as patterns in function definitions. For example, the =not= function is defined in the standard library by: -#+begin_example -not : Bool -> Bool; -not true := false; -not false := true; -#+end_example -The first line is the /signature/ which specifies the type of the definition. In this case, =not= is a function from =Bool= to =Bool=. The signature is followed by two /function clauses/ which specify the function result depending on the shape of the arguments. When a function call is evaluated, the first clause that matches the arguments is used. - -In contrast to languages like Python, Java or C/C++, Juvix doesn't require parentheses for function calls. All the arguments are just listed after the function. The general pattern for function application is: =func arg1 arg2 arg3 ...= - -A more complex example of a data type is the =Nat= type from the standard library: -#+begin_example -type Nat := -| zero : Nat -| suc : Nat -> Nat; -#+end_example -The constructor =zero= represents =0= and =suc= represents the successor function -- =suc n= is the successor of =n=, i.e., =n+1=. For example, =suc zero= represents =1=. The number literals =0=, =1=, =2=, etc., are just shorthands for appropriate expressions built using =suc= and =zero=. - -The constructors of a data type specify how the elements of the type can be constructed. For instance, the above definition specifies that an element of =Nat= is either: - * =zero=, or - * =suc n= where =n= is an element of =Nat=, i.e., it is constructed by applying =suc= to appropriate arguments (in this case the argument of =suc= has type =Nat=). -Any element of =Nat= can be built with the constructors in this way -- there are no other elements. Mathematically, this is an inductive definition, which is why the data type is called /inductive/. - -If implemented directly, the above unary representation of natural numbers would be extremely inefficient. The Juvix compiler uses a binary number representation under the hood and implements arithmetic operations using corresponding machine instructions, so the performance of natural number arithmetic is similar to other programming languages. The =Nat= type is a high-level presentation of natural numbers as seen by the user who does not need to worry about low-level arithmetic implementation details. - -One can use =zero= and =suc= in pattern matching, like any other constructors: -#+begin_example -infixl 6 +; -+ : Nat -> Nat -> Nat; -+ zero b := b; -+ (suc a) b := suc (a + b); -#+end_example -The =infixl 6 += declares =+= to be an infix left-associative operator with priority 6. The =+= is an ordinary function, except that function application for =+= is written in infix notation. The definitions of the clauses of =+= still need the prefix notation on the left-hand sides. - -The =a= and =b= in the patterns on the left-hand sides of the clauses are /variables/ which match arbitrary values of the corresponding type. They can be used on the right-hand side to refer to the values matched. For example, when evaluating -#+begin_example -(suc (suc zero)) + zero -#+end_example -the second clause of =+= matches, assigning =suc zero= to =a= and =zero= to =b=. Then the right-hand side of the clause is evaluated with =a= and =b= substituted by these values: -#+begin_example -suc (suc zero + zero) -#+end_example -Again, the second clause matches, now with both =a= and =b= being =zero=. After replacing with the right-hand side, we obtain: -#+begin_example -suc (suc (zero + zero)) -#+end_example -Now the first clause matches and finally we obtain the result -#+begin_example -suc (suc zero) -#+end_example -which is just =2=. - -The function =+= is defined like above in the standard library, but the Juvix compiler treats it specially and generates efficient code using appropriate CPU instructions. - -** Pattern matching - -The patterns in function clauses do not have to match on a single constructor -- they may be arbitrarily deep. For example, here is an (inefficient) implementation of a function which checks whether a natural number is even: -#+begin_example -even : Nat -> Bool; -even zero := true; -even (suc zero) := false; -even (suc (suc n)) := even n; -#+end_example -This definition states that a natural number =n= is even if either =n= is =zero= or, recursively, =n-2= is even. - -If a subpattern is to be ignored, then one can use a wildcard =_= instead of naming the subpattern. -#+begin_example -isPositive : Nat -> Bool; -isPositive zero := false; -isPositive (suc _) := true; -#+end_example -The above function could also be written as: -#+begin_example -isPositive : Nat -> Bool; -isPositive zero := false; -isPositive _ := true; -#+end_example - -It is not necessary to define a separate function to perform pattern matching. One can use the =case= syntax to pattern match an expression directly. -#+begin_example -Stdlib.Prelude> case (1, 2) | (suc _, zero) := 0 | (suc _, suc x) := x | _ := 19 -1 -#+end_example - -** Comparisons and conditionals - -To use the comparison operators on natural numbers, one needs to import the =Stdlib.Data.Nat.Ord= module. The comparison operators are not in =Stdlib.Prelude= to avoid clashes with user-defined operators for other data types. The functions available in =Stdlib.Data.Nat.Org= include: =<=, =<==, =>=, =>==, ====, =/==, =min=, =max=. - -For example, one may define the function =max3= by: -#+begin_example -open import Stdlib.Data.Nat.Ord; - -max3 : Nat -> Nat -> Nat -> Nat; -max3 x y z := if (x > y) (max x z) (max y z); -#+end_example -The conditional =if= is a special function which is evaluated lazily, i.e., first the condition (the first argument) is evaluated, and then depending on its truth-value one of the branches (the second or the third argument) is evaluated and returned. - -By default, evaluation in Juvix is /eager/ (or /strict/), meaning that the arguments to a function are fully evaluated before applying the function. Only =if=, =||= and =&&= are treated specially and evaluated lazily. These special functions cannot be partially applied (see [[./learn.md#partial-application-and-higher-order-functions][Partial application and higher-order functions]] below). - -** Local definitions - -Juvix supports local definitions with let-expressions. -#+begin_example -f : Nat -> Nat; -f a := let x : Nat := a + 5; - y : Nat := a * 7 + x - in - x * y; -#+end_example -The variables =x= and =y= are not visible outside =f=. - -One can also use multi-clause definitions in =let=-expressions, with the same syntax as definitions inside a module. For example: -#+begin_example -even' : Nat -> Bool; -even' := - let - even : Nat -> Bool; - odd : Nat -> Bool; - - even zero := true; - even (suc n) := odd n; - - odd zero := false; - odd (suc n) := even n; - in - even -#+end_example -The functions =even= and =odd= are not visible outside =even'=. - -** Recursion - -Juvix is a purely functional language, which means that functions have no side effects and all variables are immutable. An advantage of functional programming is that all expressions are /referentially transparent/ -- any expression can be replaced by its value without changing the meaning of the program. This makes it easier to reason about programs, in particular to prove their correctness. No errors involving implicit state are possible, because the state is always explicit. - -In a functional language, there are no imperative loops. Repetition is expressed using recursion. In many cases, the recursive definition of a function follows the inductive definition of a data structure the function analyses. For example, consider the following inductive type of lists of natural numbers: -#+begin_example -type NList := -| nnil : NList -| ncons : Nat -> NList -> NList; -#+end_example -An element of =NList= is either =nnil= (empty) or =ncons x xs= where =x : Nat= and =xs : NList= (a list with head =x= and tail =xs=). - -A function computing the length of a list may be defined by: -#+begin_example -nlength : NList -> Nat; -nlength nnil := 0; -nlength (ncons _ xs) := nlength xs + 1; -#+end_example -The definition follows the inductive definition of =NList=. There are two function clauses for the two constructors. The case for =nnil= is easy -- the constructor has no arguments and the length of the empty list is =0=. For a constructor with some arguments, one typically needs to express the result of the function in terms of the constructor arguments, usually calling the function recursively on the constructor's inductive arguments (for =ncons= this is the second argument). In the case of =ncons _ xs=, we recursively call =nlength= on =xs= and add =1= to the result. - -Let's consider another example -- a function which returns the maximum of the numbers in a list or 0 for the empty list. -#+begin_example -open import Stdlib.Data.Nat.Ord; -- for `max` - -nmaximum : NList -> Nat; -nmaximum nnil := 0; -nmaximum (ncons x xs) := max x (nmaximum xs); -#+end_example -Again, there is a clause for each constructor. In the case for =ncons=, we recursively call the function on the list tail and take the maximum of the result and the list head. - -For an example of a constructor with more than one inductive argument, consider binary trees with natural numbers in nodes. -#+begin_example -type Tree := -| leaf : Nat -> Tree -| node : Nat -> Tree -> Tree -> Tree; -#+end_example -The constructor =node= has two inductive arguments (the second and the third) which represent the left and the right subtree. - -A function which produces the mirror image of a tree may be defined by: -#+begin_example -mirror : Tree -> Tree; -mirror (leaf x) := leaf x; -mirror (node x l r) := node x (mirror r) (mirror l); -#+end_example -The definition of =mirror= follows the definition of =Tree=. There are two recursive calls for the two inductive constructors of =node= (the subtrees). - -** Partial application and higher-order functions - -Strictly speaking, all Juvix functions have only one argument. Multi-argument functions are really functions which return a function which takes the next argument and returns a function taking another argument, and so on for all arguments. The function type former =->= (the arrow) is right-associative. Hence, the type, e.g., =Nat -> Nat -> Nat= when fully parenthesised becomes =Nat -> (Nat -> Nat)=. It is the type of functions which given an argument of type =Nat= return a function of type =Nat -> Nat= which itself takes an argument of type =Nat= and produces a result of type =Nat=. Function application is left-associative. For example, =f a b= when fully parenthesised becomes =(f a) b=. So it is an application to =b= of the function obtained by applying =f= to =a=. - -Since a multi-argument function is just a one-argument function returning a function, it can be /partially applied/ to a smaller number of arguments than specified in its definition. The result is an appropriate function. For example, =sub 10= is a function which subtracts its argument from =10=, and =(+) 1= is a function which adds =1= to its argument. If the function has been declared as an infix operator (like =+=), then for partial application one needs to enclose it in parentheses. - -A function which takes a function as an argument is a /higher-order function/. An example is the =nmap= function which applies a given function to each element in a list of natural numbers. -#+begin_example -nmap : (Nat -> Nat) -> NList -> NList; -nmap _ nnil := nnil; -nmap f (ncons x xs) := ncons (f x) (nmap f xs); -#+end_example - -The application -#+begin_example -nmap \{ x := div x 2 } lst -#+end_example -divides every element of =lst= by =2=, rounding down the result. The expression -#+begin_example -\{ x := div x 1 } -#+end_example -is an unnamed function, or a /lambda/, which divides its argument by =2=. - -** Polymorphism - -The type =NList= we have been working with above requires the list elements to be natural numbers. It is possible to define lists /polymorphically/, parameterising them by the element type. This is analogous to generics in languages like Java, C++ or Rust. Here is the polymorphic definition of lists from the standard library: -#+begin_example -infixr 5 ::; -type List (A : Type) := -| nil : List A -| :: : A -> List A -> List A; -#+end_example -The constructor =::= is declared as a right-associative infix operator with priority 5. The definition has a parameter =A= which is the element type. - -Now one can define the =map= function polymorphically: -#+begin_example -map : {A B : Type} -> (A -> B) -> List A -> List B; -map f nil := nil; -map f (h :: hs) := f h :: map f hs; -#+end_example -This function has two /implicit type arguments/ =A= and =B=. These arguments are normally omitted in function application -- they are inferred automatically during type checking. The curly braces indicate that the argument is implicit and should be inferred. - -In fact, the constructors =nil= and =::= also have an implicit argument: the type of list elements. All type parameters of a data type definition become implicit arguments of the constructors. - -Usually, the implicit arguments in a function application can be inferred. However, sometimes this is not possible and then the implicit arguments need to be provided explicitly by enclosing them in braces: -#+begin_example -f {implArg1} .. {implArgK} arg1 .. argN -#+end_example -For example, =nil {Nat}= has type =List Nat= while =nil= by itself has type ={A : Type} -> List A=. - -** Tail recursion - -Any recursive call whose result is further processed by the calling function needs to create a new stack frame to save the calling function environment. This means that each such call will use a constant amount of memory. For example, a function =sum= implemented as follows will use an additional amount of memory proportional to the length of the processed list: -#+begin_example -sum : NList -> Nat; -sum nnil := 0; -sum (ncons x xs) := x + sum xs; -#+end_example -This is not acceptable if you care about performance. In an imperative language, one would use a simple loop going over the list without any memory allocation. In pseudocode: -#+begin_example -var sum : Nat := 0; -while (lst /= nnil) { - sum := sum + head lst; - lst := tail lst; -}; -return sum; -#+end_example -Fortunately, it is possible to rewrite this function to use /tail recursion/. A recursive call is /tail recursive/ if its result is also the result of the calling function, i.e., the calling function returns immediately after it without further processing. The Juvix compiler /guarantees/ that all tail calls will be eliminated, i.e., that they will be compiled to simple jumps without extra memory allocation. In a tail recursive call, instead of creating a new stack frame, the old one is reused. - -The following implementation of =sum= uses tail recursion. -#+begin_example -sum : NList -> Nat; -sum lst := - let - go : Nat -> NList -> Nat; - go acc nnil := acc; - go acc (ncons x xs) := go (acc + x) xs; - in - go 0 lst; -#+end_example -The first argument of =go= is an /accumulator/ which holds the sum computed so far. It is analogous to the =sum= variable in the imperative loop above. The initial value of the accumulator is 0. The function =go= uses only constant additional memory overall. The code generated for it by the Juvix compiler is equivalent to an imperative loop. - -# A shorter way of writing the above =sum= function is to use a /named lambda/: -# #+begin_example -# sum : NList -> Nat; -# sum := go(acc := 0)@\{ -# acc nnil := acc; -# acc (ncons x xs) := go (acc + x) xs; -# }; -# #+end_example -# The syntax -# #+begin_example -# go(acc1 := v1= ... accn := vn)@\{ } -# #+end_example -# introduces a recursive function =go= with =n= accumulators =acc1=, ..., =accn= and further =k= arguments of the lambda expression (above =n = k = 1=). The value of the entire expression is =go v1 ... vn=. The scope of =go= is the lambda expression, i.e., it is not visible outside of it. - -Most imperative loops may be translated into tail recursive functional programs by converting the locally modified variables into accumulators and the loop condition into pattern matching. For example, here is an imperative pseudocode for computing the nth Fibonacci number in linear time. The variables =cur= and =next= hold the last two computed Fibonacci numbers. -#+begin_example -var cur : Nat := 0; -var next : Nat := 1; -while (n /= 0) { - var tmp := next; - next := cur + next; - cur := tmp; - n := n - 1; -}; -return cur; -#+end_example -An equivalent functional program is: -#+begin_example -fib : Nat -> Nat; -fib := - let go : Nat -> Nat -> Nat -> Nat; - go cur _ zero := cur; - go cur next (suc n) := go next (cur + next) n; - in - go 0 1; -#+end_example -A naive definition of the Fibonacci function runs in exponential time: -#+begin_example -fib : Nat -> Nat; -fib zero := 0; -fib (suc zero) := 1; -fib (suc (suc n)) := fib n + fib (suc n); -#+end_example - -Tail recursion is less useful when the function needs to allocate memory anyway. For example, one could make the =map= function from the previous section tail recursive, but the time and memory use would still be proportional to the length of the input because of the need to allocate the result list. - -** Totality checking - -By default, the Juvix compiler requires all functions to be total. Totality consists of: - * [[../explanations/totality/termination.md][termination]], - * [[../explanations/totality/coverage.md][coverage]], - * [[../explanations/totality/positive.md][strict positivity]]. - -The termination check ensures that all functions are structurally recursive, i.e., all recursive call are on structurally smaller value -- subpatterns of the matched pattern. For example, the termination checker rejects the definition -#+begin_example -fact : Nat -> Nat; -fact x := if (x == 0) 1 (x * fact (sub x 1)); -#+end_example -because the recursive call is not on a subpattern of a pattern matched on in the clause. One can reformulate this definition so that it is accepted by the termination checker: -#+begin_example -fact : Nat -> Nat; -fact zero := 1; -fact x@(suc n) := x * fact n; -#+end_example -Sometimes, such a reformulation is not possible. Then one can use the =terminating= keyword to forgoe the termination check. -#+begin_example -terminating -log2 : Nat -> Nat; -log2 n := if (n <= 1) 0 (suc (log2 (div n 2))); -#+end_example - -Coverage checking ensures that there are no unhandled patterns in function clauses or =case= expressions. For example, the following definition is rejected because the case =suc zero= is not handled: -#+begin_example -even : Nat -> Bool; -even zero := true; -even (suc (suc n)) := even n; -#+end_example - -NOTE: Coverage checking will be implemented only in Juvix version 0.4. Earlier versions of Juvix accept non-exhaustive patterns. - -** Exercises - -You have now learnt the very basics of Juvix. To consolidate your understanding of Juvix and functional programming, try doing some of the following exercises. To learn how to write more complex Juvix programs, see the [[https://docs.juvix.org/examples/html/Tutorial/Tutorial.html][advanced tutorial]] and the [[../reference/examples.md][Juvix program examples]]. - -1. Define a function =prime : Nat -> Nat= which checks if a given natural number is prime. - -2. What is wrong with the following definition? - #+begin_example - half : Nat -> Nat; - half n := if (n < 2) 0 (half (n - 2) + 1); - #+end_example - How can you reformulate this definition so that it is accepted by Juvix? - -3. Define a polymorphic function which computes the last element of a list. What is the result of your function on the empty list? - -4. A /suffix/ of a list =l= is any list which can be obtained from =l= by removing some initial elements. For example, the suffixes of =1 :: 2 :: 3 :: nil= are: =1 :: 2 :: 3 :: nil=, =2 :: 3 :: nil=, =3 :: nil= and =nil=. - - Define a function which computes the list of all suffixes of a given list in the order of decreasing length. - -5. Recall the =Tree= type from above. - #+begin_example - type Tree := - | leaf : Nat -> Tree - | node : Nat -> Tree -> Tree -> Tree; - #+end_example - Analogously to the =map= function for lists, define a function - #+begin_example - tmap : (Nat -> Nat) -> Tree -> Tree - #+end_example - which applies a function to all natural numbers stored in a tree. - -6. Make the =Tree= type polymorphic in the element type and repeat the previous exercise. - -7. Write a tail recursive function which reverses a list. - -8. Write a tail recursive function which computes the factorial of a natural number. - -9. Define a function =comp : {A : Type} -> List (A -> A) -> A -> A= which composes all functions in a list. For example, - #+begin_example - comp (suc :: (*) 2 :: \{x := sub x 1} :: nil) - #+end_example - should be a function which given =x= computes =2(x - 1) + 1=. diff --git a/docs/org/tutorials/nodejs-interop.org b/docs/org/tutorials/nodejs-interop.org deleted file mode 100644 index ecad4c2d7..000000000 --- a/docs/org/tutorials/nodejs-interop.org +++ /dev/null @@ -1,108 +0,0 @@ -* NodeJS Interop - -A Juvix module can be compiled to a Wasm module. When a Wasm module is -instantiated by a host, functions from the host can be injected into a Wasm -module and functions from the Wasm module can be called by the host. - -In this tutorial you will see how to call host functions in Juvix and call Juvix -functions from the host using the Wasm mechanism. - -** The Juvix module - -The following Juvix module has two functions. - -The function =hostDisplayString= is an =axiom= with no corresponding =compile= -block that implements it. We will inject an implementation for this function -when we instantiate the module from NodeJS. - -The function =juvixRender= is a normal Juvix function. We will call this from -NodeJS. - -#+begin_src --- NodeJsInterop.juvix -module NodeJsInterop; - -open import Stdlib.Prelude; - -axiom hostDisplayString : String → IO; - -juvixRender : IO; -juvixRender := hostDisplayString "Hello World from Juvix!"; - -end; -#+end_src - -** Compiling the Juvix module - -The Juvix module can be compiled using the following command: - -#+begin_src -juvix compile -t wasm -r standalone NodeJsInterop.juvix -#+end_src - -This will create a file containing a Wasm module called =NodeJsInterop.wasm=. - -** The NodeJS module - -The following NodeJS module demonstrates both calling a Juvix function from -NodeJS and injecting a NodeJS function into a Juvix module. - -The NodeJS function =hostDisplayString= is passed to the Wasm module -=NodeJSInterop.wasm= when it is instantiated. After instantiation the Juvix -function =juvixRender= is called. - -The functions =ptrToCstr= and =cstrlen= are necessary to convert the =char= -pointer passed from Juvix to a JS =String=. - -#+begin_src -// NodeJSInterop.js -const fs = require('fs'); -let wasmModule = null; - -function cstrlen(mem, ptr) { - let len = 0; - while (mem[ptr] != 0) { - len++; - ptr++; - } - return len; -} - -function ptrToCstr(ptr) { - const wasmMemory = wasmModule.instance.exports.memory.buffer; - const mem = new Uint8Array(wasmMemory); - const len = cstrlen(mem, ptr); - const bytes = new Uint8Array(wasmMemory, ptr, len); - return new TextDecoder().decode(bytes); -} - -function hostDisplayString(strPtr) { - const text = ptrToCstr(strPtr); - console.log(text); -} - -const wasmBuffer = fs.readFileSync("NodeJsInterop.wasm"); -WebAssembly.instantiate(wasmBuffer, { - env: { - hostDisplayString, - } -}).then((w) => { - wasmModule = w; - wasmModule.instance.exports.juvixRender(); -}); -#+end_src - -** Running the Wasm module - -Now you should have the files =NodeJsInterop.wasm= and =NodeJsInterop.js= in the -same directory. Run the following command to execute the module: - -#+begin_src -node NodeJsInterop.js -#+end_src - -You should see the following output: - -#+begin_src -Hello World from Juvix! -#+end_src diff --git a/docs/org/quick-start.org b/docs/quick-start.md similarity index 55% rename from docs/org/quick-start.org rename to docs/quick-start.md index 428ae9bf0..ad4eaa793 100644 --- a/docs/org/quick-start.org +++ b/docs/quick-start.md @@ -1,64 +1,63 @@ -* Quick Start +# Quick Start -#+begin_html Juvix Mascot -#+end_html -To install Juvix, follow the instructions in the [[./howto/installing.md][Installation How-to]]. +To install Juvix, follow the instructions in the [Installation +How-to](./howto/installing.md). -After installation, run =juvix --help= to see the list of commands. +After installation, run `juvix --help` to see the list of commands. Run Juvix doctor to check your system setup: -#+begin_src shell +```shell juvix doctor -#+end_src +``` -** CLI Usage Examples +## CLI Usage Examples Create a new package: -#+begin_src shell +```shell juvix init -#+end_src +``` Compile a source file into an executable: -#+begin_src shell +```shell juvix compile path/to/source.juvix -#+end_src +``` Compile a source file into a WebAssembly binary: -#+begin_src shell +```shell juvix compile -t wasm path/to/source.juvix -#+end_src +``` Launch the REPL: -#+begin_src shell +```shell juvix repl -#+end_src +``` Typecheck a source file: -#+begin_src shell +```shell juvix typecheck path/to/source.juvix -#+end_src +``` Generate HTML representations of a source file and its imports: -#+begin_src shell +```shell juvix html --recursive path/to/source.juvix -#+end_src +``` -** The Hello World example +## The Hello World example This is the Juvix source code of the traditional Hello World program. -#+begin_src shell +```shell -- HelloWorld.juvix module HelloWorld; @@ -68,22 +67,25 @@ main : IO; main := printStringLn "hello world!"; end; -#+end_src +``` -To compile and run a binary generated by Juvix, save the source code to a file -called =HelloWorld.juvix= and run the following command from the directory -containing it: +To compile and run a binary generated by Juvix, save the source code to +a file called `HelloWorld.juvix` and run the following command from the +directory containing it: -#+begin_src shell +```shell juvix compile HelloWorld.juvix ./HelloWorld -#+end_src +``` -You should see the output: =hello world!= +You should see the output: `hello world!` -The source code can also be compiled to a WebAssembly binary. This requires some additional setup. See the [[https://anoma.github.io/juvix/howto/installing.html][Installation How-to]] for more information. You can also run =juvix doctor= to check your setup. +The source code can also be compiled to a WebAssembly binary. This +requires some additional setup. See the [Installation +How-to](https://anoma.github.io/juvix/howto/installing.html) for more +information. You can also run `juvix doctor` to check your setup. -#+begin_src shell +```shell juvix compile --target wasm HelloWorld.juvix wasmer HelloWorld.wasm -#+end_src +``` diff --git a/docs/reference/benchmarks.md b/docs/reference/benchmarks.md new file mode 100644 index 000000000..680d5655b --- /dev/null +++ b/docs/reference/benchmarks.md @@ -0,0 +1 @@ +# Benchmarks diff --git a/docs/reference/examples.md b/docs/reference/examples.md new file mode 100644 index 000000000..824ffa0e9 --- /dev/null +++ b/docs/reference/examples.md @@ -0,0 +1,10 @@ +The following links are clickable versions of their corresponding Juvix +programs. The HTML output is generated by running +`juvix html --recursive FileName.juvix`. + +- [HelloWorld.juvix](https://docs.juvix.org/examples/html/HelloWorld/HelloWorld.html) +- [Fibonacci.juvix](https://docs.juvix.org/examples/html/Fibonacci/Fibonacci.html) +- [Hanoi.juvix](https://docs.juvix.org/examples/html/Hanoi/Hanoi.html) +- [PascalsTriangle.juvix](https://docs.juvix.org/examples/html/PascalsTriangle/PascalsTriangle.html) +- [Collatz.juvix](https://docs.juvix.org/examples/html/Collatz/Collatz.html) +- [TicTacToe.juvix](https://docs.juvix.org/examples/html/TicTacToe/CLI/CLI.TicTacToe.html) diff --git a/docs/reference/judoc.md b/docs/reference/judoc.md new file mode 100644 index 000000000..6e7f68008 --- /dev/null +++ b/docs/reference/judoc.md @@ -0,0 +1 @@ +# Judoc reference diff --git a/docs/reference/language/README.md b/docs/reference/language/README.md new file mode 100644 index 000000000..668612de5 --- /dev/null +++ b/docs/reference/language/README.md @@ -0,0 +1,7 @@ +- [Functions](./functions.md) +- [Data types](./datatypes.md) +- [Modules](./modules.md) +- [Local definitions](./let.md) +- [Control structures](./control.md) +- [Comments](./comments.md) +- [Axioms](./axioms.md) diff --git a/docs/reference/language/axioms.md b/docs/reference/language/axioms.md new file mode 100644 index 000000000..355b4f20b --- /dev/null +++ b/docs/reference/language/axioms.md @@ -0,0 +1,16 @@ +# Axiom + +Axioms or postulates can be introduced by using the `axiom` keyword. For +example, let us imagine one wants to write a program that assumes _A_ is +a type, and there exists a term _x_ that inhabits _A_. Then the program +would look like the following. + + -- Example.juvix + module Example; + axiom A : Type; + axiom x : A; + end; + +Terms introduced by the `axiom` keyword lack any computational content. +Programs containing axioms not marked as builtins cannot be compiled to +most targets. diff --git a/docs/reference/language/builtins.md b/docs/reference/language/builtins.md new file mode 100644 index 000000000..ebe4c7333 --- /dev/null +++ b/docs/reference/language/builtins.md @@ -0,0 +1,30 @@ +# Built-ins + +Juvix has support for the built-in natural type and a few functions that +are compiled to efficient primitives. + +1. Built-in inductive definitions. + + ```juvix + builtin nat + type Nat := + zero : Nat | + suc : Nat → Nat; + ``` + +2. Builtin function definitions. + + ```juvix + infixl 6 +; + builtin nat-plus + + : Nat → Nat → Nat; + + zero b := b; + + (suc a) b := suc (a + b); + ``` + +3. Builtin axiom definitions. + + ```juvix + builtin nat-print + axiom printNat : Nat → Action; + ``` diff --git a/docs/reference/language/comments.md b/docs/reference/language/comments.md new file mode 100644 index 000000000..654377cc6 --- /dev/null +++ b/docs/reference/language/comments.md @@ -0,0 +1,19 @@ +# Comments + +Comments follow the same syntax as in `Haskell` and `Agda`. Be aware, +Juvix has no support for nested comments. + +- Inline Comment + + + + -- This is a comment! + +- Region comment + + + + {- + This is a comment! + + -} diff --git a/docs/reference/language/control.md b/docs/reference/language/control.md new file mode 100644 index 000000000..943c381db --- /dev/null +++ b/docs/reference/language/control.md @@ -0,0 +1,34 @@ +# Control structures + +## Case + +A case expression has the following syntax: + +```juvix +case value +| pat1 := branch1 +.. +| patN := branchN +``` + +For example, one can evaluate the following expression in the REPL: + +```juvix +Stdlib.Prelude> case 2 | zero := 0 | suc x := x | _ := 19 +1 +``` + +## Lazy builtins + +The standard library provides several builtin functions which are +treated specially and evaluated lazily. These builtins must always be +fully applied. + +- `if condition branch1 branch2`. First evaluates `condition`, if true + evaluates and returns `branch1`, otherwise evaluates and returns + `branch2`. +- `a || b`. Lazy disjunction. First evaluates `a`, if true returns + true, otherwise evaluates and returns `b`. +- `a && b`. Lazy conjunction. First evaluates `a`, if false returns + false, otherwise evaluates and returns `b`. +- `a >> b`. Sequences two IO actions. Lazy in the second argument. diff --git a/docs/reference/language/datatypes.md b/docs/reference/language/datatypes.md new file mode 100644 index 000000000..972e89913 --- /dev/null +++ b/docs/reference/language/datatypes.md @@ -0,0 +1,57 @@ +# Data types + +A data type declaration consists of: + +- The `type` keyword, +- a unique name for the type, +- the `:=` symbol, and +- a non-empty list of constructor declarations (functions for + building the elements of the data type). + +The simplest data type is the `Unit` type with one constructor called +`unit`. + +```juvix +type Unit := unit : Unit; +``` + +In the following example, we declare the type `Nat` – the unary +representation of natural numbers. This type comes with two +constructors: `zero` and `suc`. Example elements of type `Nat` are the +number one represented by `suc zero`, the number two represented by +`suc (suc zero)`, etc. + +```juvix +type Nat := + zero : Nat + | suc : Nat -> Nat; +``` + +Constructors can be used like normal functions or in patterns when +defining functions by pattern matching. For example, here is a function +adding two natural numbers: + +```juvix +infixl 6 +; ++ : Nat -> Nat -> Nat; ++ zero b := b; ++ (suc a) b := suc (a + b); +``` + +A data type may have type parameters. A data type with a type parameter +`A` is called _polymorphic in_ `A`. A canonical example is the type +`List` polymorphic in the type of list elements. + +```juvix +infixr 5 ::; +type List (A : Type) := + nil : List A + | :: : A -> List A -> List A; + +elem : {A : Type} -> (A -> A -> Bool) -> A -> List A -> Bool; +elem _ _ nil := false; +elem eq s (x :: xs) := eq s x || elem eq s xs; +``` + +For more examples of inductive types and how to use them, see [the Juvix +standard library](https://anoma.github.io/juvix-stdlib/). diff --git a/docs/reference/language/functions.md b/docs/reference/language/functions.md new file mode 100644 index 000000000..d40dfa07a --- /dev/null +++ b/docs/reference/language/functions.md @@ -0,0 +1,93 @@ +# Function declarations + +A function declaration consists of a type signature and a group of +_function clauses_. + +In the following example, we define a function `multiplyByTwo`. The +first line `multiplyByTwo : Nat -> Nat;` is the type signature and the +second line `multiplyByTwo n := 2 * n;` is a function clause. + +```juvix +open import Stdlib.Prelude; + +multiplyByTwo : Nat -> Nat; +multiplyByTwo n := 2 * n; +``` + +A function may have more than one function clause. When a function is +called, the first clause that matches the arguments is used. + +The following function has two clauses. + +```juvix +open import Stdlib.Prelude; + +neg : Bool -> Bool; +neg true := false; +neg false := true; +``` + +When `neg` is called with `true`, the first clause is used and the +function returns `false`. Similarly, when `neg` is called with `false`, +the second clause is used and the function returns `true`. + +## Mutually recursive functions + +Function declarations can depend on each other recursively. In the +following example, we define a function that checks if a number is +`even` by calling a function that checks if a number is `odd`. + +```juvix +open import Stdlib.Prelude; + +odd : Nat -> Bool; +even : Nat -> Bool; + +odd zero := false; +odd (suc n) := even n; + +even zero := true; +even (suc n) := odd n; +``` + +## Anonymous functions + +Anonymous functions, or _lambdas_, are introduced with the syntax: + +```juvix +\{| pat1 .. patN_1 := clause1 + | .. + | pat1 .. patN_M := clauseM} +``` + +The first pipe `|` is optional. Instead of `\` one can also use `λ`. + +An anonymous function just lists all clauses of a function without +naming it. Any function declaration can be converted to use anonymous +functions: + +```juvix +open import Stdlib.Prelude; + +odd : Nat -> Bool; +even : Nat -> Bool; + +odd := \{ + | zero := false + | (suc n) := even n +}; + +even := \{ + | zero := true + | (suc n) := odd n +}; +``` + +## Short definitions + +A function definition can be written in one line, with the body +immediately following the signature: + +```juvix +multiplyByTwo : Nat -> Nat := \{n := 2 * n}; +``` diff --git a/docs/reference/language/let.md b/docs/reference/language/let.md new file mode 100644 index 000000000..841a90c06 --- /dev/null +++ b/docs/reference/language/let.md @@ -0,0 +1,18 @@ +# Local definitions + +Local definitions are introduced with the `let` construct. + +```juvix +sum : NList -> Nat; +sum lst := + let + go : Nat -> NList -> Nat; + go acc nnil := acc; + go acc (ncons x xs) := go (acc + x) xs; + in + go 0 lst; +``` + +The declaractions in a `let` have the same syntax as declarations inside +a module, but they are visible only in the expression following the `in` +keyword. diff --git a/docs/reference/language/modules.md b/docs/reference/language/modules.md new file mode 100644 index 000000000..217453b3e --- /dev/null +++ b/docs/reference/language/modules.md @@ -0,0 +1,166 @@ +# Module system + +## Defining a module + +The `module` keyword stars the declaration of a module followed by its +name and body. The module declaration ends with the `end` keyword. + +```juvix +-- ModuleName.juvix +module ModuleName; + +end; +``` + +A Juvix project is a collection of Juvix modules inside one main +project folder containing a metadata file named `juvix.yaml`. Each Juvix +file has to define a module of the same name. The name of the +module must coincide with the path of the its file relative to its +project's root directory. For example, if the file is +`root/Data/List.juvix` then the module must be called `Data.List`, +assuming `root` is the project's folder. + +To check that Juvix is correctly detecting your project's root, one can +run the command `juvix dev root File.juvix`. + +## Importing modules + +To bring into the current scope all module definitions from other +external modules, one can use the `import` keyword along with the +corresponding module name. This way, one gets all the imported names +qualified. + +```juvix +-- A.juvix +module A; + axiom Nat : Type; + axiom zero : Nat; +end; + +-- B.juvix +module B; + import A; + x : A.Nat; + x := A.zero; +``` + +Additionally, one can open an imported module making available +all its names by their unqualified name. + +```juvix +-- A.juvix +module A; + axiom Nat : Type; + axiom zero : Nat; +end; + +-- B.juvix +module B; + import A; + open A; + x : Nat; + x := zero; +``` + +However, opening modules may create name collisions if you already have +the imported names as definitions in the current module. In this case, +Juvix will complain with an error, letting you know which symbols are +ambiguous. For example, in module `B` below, the name `a` is ambiguous. + +```juvix +-- A.juvix +module A; +axiom A : Type; +axiom a : A; +end; + +-- B.juvix +module B; +import A; +open A; +axiom a : A; + +x := a; +end; +``` + +One alternative here is hiding the name `a` as follows. + +```juvix +-- B.juvix +module B; +import A; +open A hiding {a}; + +axiom a : A; +x := a; + +end; +``` + +Now, we can use the `open import` syntax to simplify the `import-open` +statements. + +Instead of having: + +```juvix +import Prelude; +open Prelude; +``` + +We simplify it by the expression: + +```juvix +open import Prelude; +``` + +The `hiding` keyword can be used within an `open-import` statement. + +```juvix +-- B.juvix +module A; +open import A hiding {a}; +axiom a : A; +x := a; +end; +``` + +## Exporting symbols + +The module `C` below does not typecheck. Both symbols, originally +defined in module `A`, are not visible in module `C` after importing +`B`. The symbols `A` and `a` are not exported by the module `B`. To +export symbols from an imported module, one can use the `public` keyword +at the end of the corresponding `open` statement. For example, the +module `C` typechecks after marking the import of `A` as `public` in +module `B`. + +```juvix +-- A.juvix +module A; +axiom A : Type; +axiom a : A; +end; + +-- B.juvix +module B; +open import A; +end; + +-- C.juvix +module C; +open import B; + +x : A; +x := a; +end; +``` + +Fix: + +```juvix +-- B.juvix +module B; +open import A public; +end; +``` diff --git a/docs/reference/stdlib.md b/docs/reference/stdlib.md new file mode 100644 index 000000000..6199e89e4 --- /dev/null +++ b/docs/reference/stdlib.md @@ -0,0 +1,2 @@ +The [Juvix standard library](https://anoma.github.io/juvix-stdlib/) +contains common functions that can be used in Juvix programs. diff --git a/docs/reference/tooling/CLI.md b/docs/reference/tooling/CLI.md new file mode 100644 index 000000000..a30888ac5 --- /dev/null +++ b/docs/reference/tooling/CLI.md @@ -0,0 +1,89 @@ +# CLI + +## Usage + +```shell +juvix [Global options] ((-v|--version) | (-h|--help) | COMPILER_CMD | UTILITY_CMD) +``` + +## Informative options + +- `-v,--version` Print the version and exit +- `-h,--help` Show this help text + +## Global Command flags + +- `--no-colors` Disable globally ANSI formatting +- `--show-name-ids` Show the unique number of each identifier when + pretty printing +- `--only-errors` Only print errors in a uniform format (used by + juvix-mode) +- `--no-termination` Disable termination checking +- `--no-positivity` Disable positivity checking for inductive types +- `--no-stdlib` Do not use the standard library + +## Main Commands + +- `html` Generate HTML output from a Juvix file +- `typecheck` Typecheck a Juvix file +- `compile` Compile a Juvix file + +## Utility Commands + +- `doctor` Perform checks on your Juvix development environment +- `init` Interactively initialize a juvix project in the current + directory + +## Dev Commands + +```shell +juvix dev COMMAND +``` + +- `parse` Parse a Juvix file +- `scope` Parse and scope a Juvix file +- `highlight` Highlight a Juvix file +- `core` Subcommands related to JuvixCore +- `asm` Subcommands related to JuvixAsm +- `root` Show the root path for a Juvix project +- `termination` Subcommands related to termination checking +- `internal` Subcommands related to Internal +- `minic` Translate a Juvix file to a subset of C + +## CLI Auto-completion Scripts + +The Juvix CLI can generate auto-completion scripts. Follow the +instructions below for your shell. + +NB: You may need to restart your shell after installing the completion +script. + +### Bash + +Add the following line to your bash init script (for example +`~/.bashrc`). + +```shell +eval "$(juvix --bash-completion-script juvix)" +``` + +### Fish + +Run the following command in your shell: + +```shell +juvix --fish-completion-script juvix + > ~/.config/fish/completions/juvix.fish +``` + +### ZSH + +Run the following command in your shell: + +```shell +juvix --zsh-completion-script juvix > $DIR_IN_FPATH/_juvix +``` + +where `$DIR_IN_FPATH` is a directory that is present on the [ZSH FPATH +variable](https://zsh.sourceforge.io/Doc/Release/Functions.html) (which +you can inspect by running `echo $FPATH` in the shell). diff --git a/docs/reference/tooling/README.md b/docs/reference/tooling/README.md new file mode 100644 index 000000000..a9f186a5f --- /dev/null +++ b/docs/reference/tooling/README.md @@ -0,0 +1,4 @@ +- [Command line Interface](./CLI.md) +- [Emacs Mode](./emacs.md) +- [Test Suite](./testing.md) +- [Doctor](./doctor.md) diff --git a/docs/reference/tooling/doctor.md b/docs/reference/tooling/doctor.md new file mode 100644 index 000000000..5c0650729 --- /dev/null +++ b/docs/reference/tooling/doctor.md @@ -0,0 +1,123 @@ +# Juvix Doctor + +The `juvix doctor` command can help you to troubleshoot problems with +your development environment. For each problem the doctor finds they'll +be a link to a section on this page to help you fix it. + +## Could not find the clang command + +The Juvix compiler uses the [Clang compiler](https://clang.llvm.org) +version 13 or later to generate binaries. You need to have Clang +available on your system `$PATH`. + +Recommended installation method: + +### MacOS + +Use [Homebrew](https://brew.sh): + +```shell +brew install llvm +``` + +NB: The distribution of Clang that comes with XCode does not support the +`Wasm` target so you must install the standard Clang distribution. + +### Debian / Ubuntu Linux + +```shell +sudo apt install clang lldb lld +``` + +### Arch Linux + +```shell +sudo pacman -S llvm lld +``` + +## Could not find the wasm-ld command + +The Juvix compiler required `wasm-ld` (the Wasm linker) to produce +`Wasm` binaries. + +Recommended installation method: + +### MacOS + +`wasm-ld` is included in the [Homebrew](https://brew.sh) llvm +distribution: + +```shell +brew install llvm +``` + +### Debian / Ubuntu Linux + +```shell +sudo apt install lldb lld +``` + +### Arch Linux + +```shell +sudo pacman -S lld +``` + +## Newer Clang version required + +Juvix requires Clang version 13 or above. See the documentation on +[installing Clang](./doctor.md#could-not-find-the-clang-command). + +## Clang does not support the wasm32 target + +Juvix requires Clang version 13 or above. See the documentation on +[installing Clang](./doctor.md#could-not-find-the-clang-command). + +## Clang does not support the wasm32-wasi target + +Juvix uses [WASI - The Wasm System Interface](https://wasi.dev) to +produce binaries that can be executed using a Wasm runtime. The files +necessary to setup Clang with `wasm32-wasi` support are available at +[wasi-sdk](https://github.com/WebAssembly/wasi-sdk/releases). + +To install the `wasm32-wasi` target for Clang you need to do two things: + +### Install `libclang_rt.builtins-wasm32.a` into your Clang distribution + +1. Obtain `libclang_rt.builtins-wasm32-wasi-16.0.tar.gz` from the + [wasi-sdk + releases](https://github.com/WebAssembly/wasi-sdk/releases) page. + +2. Untar the file and place the file + `lib/wasi/libclang_rt.builtins-wasm32.a` into your Clang + distribution directory. + + On MacOS, if you installed llvm using homebrew you can find the + Clang distribution directory using `brew --prefix llvm`. You should + then place the builtins file at + `` `brew --prefix llvm`/lib/wasi/libclang_rt.builtins-wasm32.a ``. + + On Linux the Clang distribution directory will be something like + `/usr/lib/clang/13.0.1` where `13.0.1` is the version of Clang that + you have installed. You should then place the builtins file at + `/usr/lib/clang/13.0.1/lib/wasi/libclang_rt.builtins-wasm32`. + +### Download the WASI sysroot and set `WASI_SYSROOT_PATH` + +1. Obtain `wasi-sysroot-16.0.tar.gz` from the [wasi-sdk + releases](https://github.com/WebAssembly/wasi-sdk/releases) page. +2. Untar the file and set the environment variable `WASI_SYSROOT_PATH` + to that location. + +## Environment variable `WASI_SYSROOT_PATH` is not set + +Set the `WASI_SYSROOT_PATH` to the directory where you installed the +`wasi-sdk` sysroot files. See [installing the WASI +sysroot](./doctor.md#download-the-wasi-sysroot-and-set-wasi_sysroot_path). + +## Could not find the wasmer command + +The Juvix test suite uses [Wasmer](https://wasmer.io) as a Wasm runtime +to execute compiled Wasm binaries. See [the Wasmer +documentation](https://docs.wasmer.io/ecosystem/wasmer/getting-started) +to see how to install it. diff --git a/docs/reference/tooling/emacs.md b/docs/reference/tooling/emacs.md new file mode 100644 index 000000000..0d90615a5 --- /dev/null +++ b/docs/reference/tooling/emacs.md @@ -0,0 +1,52 @@ +## Emacs Mode + +There is an Emacs mode available for Juvix. Currently, it supports +syntax highlighting for well-scoped modules. + +To get started, clone the Juvix Emacs mode repository: + +```bash +git clone https://github.com/anoma/juvix-mode.git +``` + +To install it add the following lines to your Emacs configuration file: + +```elisp +(push "/path/to/juvix-mode/" load-path) +(require 'juvix-mode) +``` + +Make sure that Juvix is installed in your `PATH`. + +The Juvix major mode will be activated automatically for `.juvix` files. + +### Keybindings + +| Key | Function Name | Description | +| --------- | ----------------------- | ----------------------------------------------------- | +| `C-c C-l` | `juvix-load` | Runs the scoper and adds semantic syntax highlighting | +| `M-.` | `juvix-goto-definition` | Go to the definition of symbol at point | +| `C-c C-f` | `juvix-format-buffer` | Format the current buffer | + +### Emacs installation + +Most Linux distributions contain an Emacs package which can be installed +with your package manager (`sudo apt install emacs` on Ubuntu). On +macOS, it is recommended to install Emacs Plus via Homebrew: +`brew install emacs-plus`. Using the Emacs Homebrew casks is not +recommended. + +### Common problems + +- Error "Symbol's value as variable is void: sh:1:" + + Make sure the juvix executable is on the Emacs' `exec-path`. Note + that `exec-path` may be different from your shell's `PATH`. This is + particularly common on macOS with Emacs launched from GUI instead of + the terminal. + + The easiest way to resolve this issue is to install the + [exec-path-from-shell](https://github.com/purcell/exec-path-from-shell) + package (available on MELPA). Alternatively, one may set `exec-path` + to match shell `PATH` by following the instructions from + [EmacsWiki](https://www.emacswiki.org/emacs/ExecPath). diff --git a/docs/reference/tooling/testing.md b/docs/reference/tooling/testing.md new file mode 100644 index 000000000..f3b6faeb0 --- /dev/null +++ b/docs/reference/tooling/testing.md @@ -0,0 +1,20 @@ +# Testing + +### Dependencies + +See [Installing dependencies](./doctor.html) for instructions on how to +setup the testing environment for the WASM compiler tests. + +### Running + +Run tests using: + +```shell +stack test +``` + +To run tests, ignoring all the WASM tests: + +```shell +stack test --ta '-p "! /slow tests/"' +``` diff --git a/docs/tutorials/README.md b/docs/tutorials/README.md new file mode 100644 index 000000000..dbacce882 --- /dev/null +++ b/docs/tutorials/README.md @@ -0,0 +1 @@ +- [NodeJS Interop](./nodejs-interop.md) diff --git a/docs/tutorials/emacs.md b/docs/tutorials/emacs.md new file mode 100644 index 000000000..ae5bdcb3b --- /dev/null +++ b/docs/tutorials/emacs.md @@ -0,0 +1,79 @@ +# Juvix Emacs mode tutorial + +First, follow the instructions in the [Emacs Mode +Reference](../reference/tooling/emacs.md) to install the Juvix Emacs +mode. Once you've successfully set it up, create a file `Hello.juvix` +with the following content. + +```juvix +module Hello; + +open import Stdlib.Prelude; + +main : IO; +main := printStringLn "Hello world!"; + +end; +``` + +Type `C-c C-l` to run the scoper and highlight the syntax. + +If you make a mistake in your program, it is automatically underlined in +red with the error message popping up when you hover the mouse pointer +over the underlined part. + +For example, in the following program the identifier `printStringLna` +should be underlined with the error message "Symbol not in scope". + +```juvix +module Hello; + +open import Stdlib.Prelude; + +main : IO; +main := printStringLna "Hello world!"; + +end; +``` + +If error underlining doesn't work, make sure you have the `flycheck` +mode turned on. It should be turned on automatically when loading +`juvix-mode`, but in case this doesn't work you can enable it with +`M-x flycheck-mode`. + +Let's extend our program with another definition. + +```juvix +module Hello; + +open import Stdlib.Prelude; + +print : IO; +print := printStringLn "Hello world!"; + +main : IO; +main := print; + +end; +``` + +Place the cursor on the `print` call in the function clause of `main` +and press `M-.`. The cursor will jump to the definition of `print` +above. This also works across files and for definitions from the +standard library. You can try using `M-.` to jump to the definition of +`printStringLn`. + +One more feature of the Juvix Emacs mode is code formatting. To format +the content of the current buffer, type `C-c C-f`. Here is the result. + +```juvix +module Hello; + open import Stdlib.Prelude; + + print : IO; + print := printStringLn "Hello world!"; + + main : IO; + main := print; +end; +``` diff --git a/docs/tutorials/learn.md b/docs/tutorials/learn.md new file mode 100644 index 000000000..115a97828 --- /dev/null +++ b/docs/tutorials/learn.md @@ -0,0 +1,792 @@ +# Juvix tutorial + +NOTE: This is a tutorial for Juvix version 0.3. Earlier versions do not +support all the syntax described here. + +- [Juvix REPL](./learn.md#juvix-repl) +- [Basic expressions](./learn.md#basic-expressions) +- [Files, modules and + compilation](./learn.md#files-modules-and-compilation) +- [Output](./learn.md#output) +- [Data types and functions](./learn.md#data-types-and-functions) +- [Pattern matching](./learn.md#pattern-matching) +- [Comparisons and + conditionals](./learn.md#comparisons-and-conditionals) +- [Local definitions](./learn.md#local-definitions) +- [Recursion](./learn.md#recursion) +- [Partial application and higher-order + functions](./learn.md#partial-application-and-higher-order-functions) +- [Polymorphism](./learn.md#polymorphism) +- [Tail recursion](./learn.md#tail-recursion) +- [Totality checking](./learn.md#totality-checking) +- [Exercises](./learn.md#exercises) + +## Juvix REPL + +After [installing Juvix](../howto/installing.md), launch the Juvix REPL: + +```shell +juvix repl +``` + +The response should be similar to: + +```juvix +Juvix REPL version 0.3: https://juvix.org. Run :help for help +OK loaded: ./.juvix-build/stdlib/Stdlib/Prelude.juvix +Stdlib.Prelude> +``` + +Currently, the REPL supports evaluating expressions but it does not yet +support adding new definitions. To see the list of available REPL +commands type `:help`. + +## Basic expressions + +You can try evaluating simple arithmetic expressions in the REPL: + +```juvix +Stdlib.Prelude> 3 + 4 +7 +Stdlib.Prelude> 1 + 3 * 7 +22 +Stdlib.Prelude> div 35 4 +8 +Stdlib.Prelude> mod 35 4 +3 +Stdlib.Prelude> sub 35 4 +31 +Stdlib.Prelude> sub 4 35 +0 +``` + +By default, Juvix operates on non-negative natural numbers. Natural number +subtraction is implemented by the function `sub`. Subtracting a bigger +natural number from a smaller one yields `0`. + +You can also try boolean expressions + +```juvix +Stdlib.Prelude> true +true +Stdlib.Prelude> not true +false +Stdlib.Prelude> true && false +false +Stdlib.Prelude> true || false +true +Stdlib.Prelude> if true 1 0 +1 +``` + +and strings, pairs and lists: + +```juvix +Stdlib.Prelude> "Hello world!" +"Hello world!" +Stdlib.Prelude> (1, 2) +(1, 2) +Stdlib.Prelude> 1 :: 2 :: nil +1 :: 2 :: nil +``` + +In fact, you can use all functions and types from the +[Stdlib.Prelude](https://anoma.github.io/juvix-stdlib/Stdlib.Prelude.html) +module of the [standard library](https://anoma.github.io/juvix-stdlib), +which is preloaded by default. + +```juvix +Stdlib.Prelude> length (1 :: 2 :: nil) +3 +Stdlib.Prelude> null (1 :: 2 :: nil) +false +Stdlib.Prelude> swap (1, 2) +(2, 1) +``` + +## Files, modules and compilation + +Currently, the REPL does not support adding new definitions. To define +new functions or data types, you need to put them in a separate file and +either load the file in the REPL with `:load file.juvix` or compile the +file to a binary executable with the shell command +`juvix compile file.juvix`. + +To conveniently edit Juvix files, an [Emacs mode](./emacs.md) and a +[VSCode extension](./vscode.md) are available. + +A Juvix file must declare a module whose name corresponds exactly to the +name of the file. For example, a file `Hello.juvix` must declare a +module `Hello`: + +```juvix +-- Hello world example. This is a comment. +module Hello; + +-- Import the standard library prelude, including the function 'printStringLn' +open import Stdlib.Prelude; + +main : IO; +main := printStringLn "Hello world!"; + +end; +``` + +A file compiled to an executable must define the zero-argument function +`main` of type `IO` which is evaluated when running the program. + +## Output + +In addition to `printStringLn`, the standard library includes the +functions `printString`, `printNat`, `printNatLn`, `printBool`, +`printBoolLn`. The `IO` computations can be sequenced with `>>`, e.g., + +```juvix +printNat 3 >> printString " + " >> printNatLn 4 +``` + +has type `IO` and when executed prints `3 + 4` followed by a newline. + +The type `IO` is the type of IO actions, i.e., of data structures +representing IO computations. The functions `printString`, `printNat`, +etc., do not immediately print their arguments, but rather create a data +structure representing an appropriate IO action. The IO actions created +by the `main` function are executed only after the program has been +evaluated. + +## Data types and functions + +To see the type of an expression, use the `:type` REPL command: + +```juvix +Stdlib.Prelude> :type 1 +Nat +Stdlib.Prelude> :type true +Bool +``` + +The types `Nat` and `Bool` are defined in the standard library. + +The type `Bool` has two constructors `true` and `false`. + +```juvix +type Bool := +| true : Bool +| false : Bool; +``` + +The constructors of a data type can be used to build elements of the +type. They can also appear as patterns in function definitions. For +example, the `not` function is defined in the standard library by: + +```juvix +not : Bool -> Bool; +not true := false; +not false := true; +``` + +The first line is the _signature_ which specifies the type of the +definition. In this case, `not` is a function from `Bool` to `Bool`. The +signature is followed by two _function clauses_ which specify the +function result depending on the shape of the arguments. When a function +call is evaluated, the first clause that matches the arguments is used. + +In contrast to languages like Python, Java or C/C++, Juvix doesn't +require parentheses for function calls. All the arguments are just +listed after the function. The general pattern for function application +is: `func arg1 arg2 arg3 ...` + +A more complex example of a data type is the `Nat` type from the +standard library: + +```juvix +type Nat := +| zero : Nat +| suc : Nat -> Nat; +``` + +The constructor `zero` represents `0` and `suc` represents the successor +function – `suc n` is the successor of `n`, i.e., `n+1`. For example, +`suc zero` represents `1`. The number literals `0`, `1`, `2`, etc., are +just shorthands for appropriate expressions built using `suc` and +`zero`. + +The constructors of a data type specify how the elements of the type can +be constructed. For instance, the above definition specifies that an +element of `Nat` is either: + +- `zero`, or +- `suc n` where `n` is an element of `Nat`, i.e., it is constructed by + applying `suc` to appropriate arguments (in this case the argument + of `suc` has type `Nat`). + +Any element of `Nat` can be built with the constructors in this way – +there are no other elements. Mathematically, this is an inductive +definition, which is why the data type is called _inductive_. + +If implemented directly, the above unary representation of natural +numbers would be extremely inefficient. The Juvix compiler uses a binary +number representation under the hood and implements arithmetic +operations using corresponding machine instructions, so the performance +of natural number arithmetic is similar to other programming languages. +The `Nat` type is a high-level presentation of natural numbers as seen +by the user who does not need to worry about low-level arithmetic +implementation details. + +One can use `zero` and `suc` in pattern matching, like any other +constructors: + +```juvix +infixl 6 +; ++ : Nat -> Nat -> Nat; ++ zero b := b; ++ (suc a) b := suc (a + b); +``` + +The `infixl 6 +` declares `+` to be an infix left-associative operator +with priority 6. The `+` is an ordinary function, except that function +application for `+` is written in infix notation. The definitions of the +clauses of `+` still need the prefix notation on the left-hand sides. + +The `a` and `b` in the patterns on the left-hand sides of the clauses +are _variables_ which match arbitrary values of the corresponding type. +They can be used on the right-hand side to refer to the values matched. +For example, when evaluating + +```juvix +(suc (suc zero)) + zero +``` + +the second clause of `+` matches, assigning `suc zero` to `a` and `zero` +to `b`. Then the right-hand side of the clause is evaluated with `a` and +`b` substituted by these values: + +```juvix +suc (suc zero + zero) +``` + +Again, the second clause matches, now with both `a` and `b` being +`zero`. After replacing with the right-hand side, we obtain: + +```juvix +suc (suc (zero + zero)) +``` + +Now the first clause matches and finally we obtain the result + +```juvix +suc (suc zero) +``` + +which is just `2`. + +The function `+` is defined like above in the standard library, but the +Juvix compiler treats it specially and generates efficient code using +appropriate CPU instructions. + +## Pattern matching + +The patterns in function clauses do not have to match on a single +constructor – they may be arbitrarily deep. For example, here is an +(inefficient) implementation of a function which checks whether a +natural number is even: + +```juvix +even : Nat -> Bool; +even zero := true; +even (suc zero) := false; +even (suc (suc n)) := even n; +``` + +This definition states that a natural number `n` is even if either `n` +is `zero` or, recursively, `n-2` is even. + +If a subpattern is to be ignored, then one can use a wildcard `_` +instead of naming the subpattern. + +```juvix +isPositive : Nat -> Bool; +isPositive zero := false; +isPositive (suc _) := true; +``` + +The above function could also be written as: + +```juvix +isPositive : Nat -> Bool; +isPositive zero := false; +isPositive _ := true; +``` + +It is not necessary to define a separate function to perform pattern +matching. One can use the `case` syntax to pattern match an expression +directly. + +```juvix +Stdlib.Prelude> case (1, 2) | (suc _, zero) := 0 | (suc _, suc x) := x | _ := 19 +1 +``` + +## Comparisons and conditionals + +To use the comparison operators on natural numbers, one needs to import +the `Stdlib.Data.Nat.Ord` module. The comparison operators are not in +`Stdlib.Prelude` to avoid clashes with user-defined operators for other +data types. The functions available in `Stdlib.Data.Nat.Org` include: +`<`, `<=`, `>`, `>=`, `==`, `/=`, `min`, `max`. + +For example, one may define the function `max3` by: + +```juvix +open import Stdlib.Data.Nat.Ord; + +max3 : Nat -> Nat -> Nat -> Nat; +max3 x y z := if (x > y) (max x z) (max y z); +``` + +The conditional `if` is a special function which is evaluated lazily, +i.e., first the condition (the first argument) is evaluated, and then +depending on its truth-value one of the branches (the second or the +third argument) is evaluated and returned. + +By default, evaluation in Juvix is _eager_ (or _strict_), meaning that +the arguments to a function are fully evaluated before applying the +function. Only `if`, `||` and `&&` are treated specially and evaluated +lazily. These special functions cannot be partially applied (see +[Partial application and higher-order +functions](./learn.md#partial-application-and-higher-order-functions) +below). + +## Local definitions + +Juvix supports local definitions with let-expressions. + +```juvix +f : Nat -> Nat; +f a := let x : Nat := a + 5; + y : Nat := a * 7 + x + in + x * y; +``` + +The variables `x` and `y` are not visible outside `f`. + +One can also use multi-clause definitions in `let`-expressions, with the +same syntax as definitions inside a module. For example: + +```juvix +even' : Nat -> Bool; +even' := + let + even : Nat -> Bool; + odd : Nat -> Bool; + + even zero := true; + even (suc n) := odd n; + + odd zero := false; + odd (suc n) := even n; + in + even +``` + +The functions `even` and `odd` are not visible outside `even'`. + +## Recursion + +Juvix is a purely functional language, which means that functions have +no side effects and all variables are immutable. An advantage of +functional programming is that all expressions are _referentially +transparent_ – any expression can be replaced by its value without +changing the meaning of the program. This makes it easier to reason +about programs, in particular to prove their correctness. No errors +involving implicit state are possible, because the state is always +explicit. + +In a functional language, there are no imperative loops. Repetition is +expressed using recursion. In many cases, the recursive definition of a +function follows the inductive definition of a data structure the +function analyses. For example, consider the following inductive type of +lists of natural numbers: + +```juvix +type NList := +| nnil : NList +| ncons : Nat -> NList -> NList; +``` + +An element of `NList` is either `nnil` (empty) or `ncons x xs` where +`x : Nat` and `xs : NList` (a list with head `x` and tail `xs`). + +A function computing the length of a list may be defined by: + +```juvix +nlength : NList -> Nat; +nlength nnil := 0; +nlength (ncons _ xs) := nlength xs + 1; +``` + +The definition follows the inductive definition of `NList`. There are +two function clauses for the two constructors. The case for `nnil` is +easy – the constructor has no arguments and the length of the empty list +is `0`. For a constructor with some arguments, one typically needs to +express the result of the function in terms of the constructor +arguments, usually calling the function recursively on the constructor's +inductive arguments (for `ncons` this is the second argument). In the +case of `ncons _ xs`, we recursively call `nlength` on `xs` and add `1` +to the result. + +Let's consider another example – a function which returns the maximum of +the numbers in a list or 0 for the empty list. + +```juvix +open import Stdlib.Data.Nat.Ord; -- for `max` + +nmaximum : NList -> Nat; +nmaximum nnil := 0; +nmaximum (ncons x xs) := max x (nmaximum xs); +``` + +Again, there is a clause for each constructor. In the case for `ncons`, +we recursively call the function on the list tail and take the maximum +of the result and the list head. + +For an example of a constructor with more than one inductive argument, +consider binary trees with natural numbers in nodes. + +```juvix +type Tree := +| leaf : Nat -> Tree +| node : Nat -> Tree -> Tree -> Tree; +``` + +The constructor `node` has two inductive arguments (the second and the +third) which represent the left and the right subtree. + +A function which produces the mirror image of a tree may be defined by: + +```juvix +mirror : Tree -> Tree; +mirror (leaf x) := leaf x; +mirror (node x l r) := node x (mirror r) (mirror l); +``` + +The definition of `mirror` follows the definition of `Tree`. There are +two recursive calls for the two inductive constructors of `node` (the +subtrees). + +## Partial application and higher-order functions + +Strictly speaking, all Juvix functions have only one argument. +Multi-argument functions are really functions which return a function +which takes the next argument and returns a function taking another +argument, and so on for all arguments. The function type former `->` +(the arrow) is right-associative. Hence, the type, e.g., +`Nat -> Nat -> Nat` when fully parenthesised becomes +`Nat -> (Nat -> Nat)`. It is the type of functions which given an +argument of type `Nat` return a function of type `Nat -> Nat` which +itself takes an argument of type `Nat` and produces a result of type +`Nat`. Function application is left-associative. For example, `f a b` +when fully parenthesised becomes `(f a) b`. So it is an application to +`b` of the function obtained by applying `f` to `a`. + +Since a multi-argument function is just a one-argument function +returning a function, it can be _partially applied_ to a smaller number +of arguments than specified in its definition. The result is an +appropriate function. For example, `sub 10` is a function which +subtracts its argument from `10`, and `(+) 1` is a function which adds +`1` to its argument. If the function has been declared as an infix +operator (like `+`), then for partial application one needs to enclose +it in parentheses. + +A function which takes a function as an argument is a _higher-order +function_. An example is the `nmap` function which applies a given +function to each element in a list of natural numbers. + +```juvix +nmap : (Nat -> Nat) -> NList -> NList; +nmap _ nnil := nnil; +nmap f (ncons x xs) := ncons (f x) (nmap f xs); +``` + +The application + +```juvix +nmap \{ x := div x 2 } lst +``` + +divides every element of `lst` by `2`, rounding down the result. The +expression + +```juvix +\{ x := div x 1 } +``` + +is an unnamed function, or a _lambda_, which divides its argument by +`2`. + +## Polymorphism + +The type `NList` we have been working with above requires the list +elements to be natural numbers. It is possible to define lists +_polymorphically_, parameterising them by the element type. This is +analogous to generics in languages like Java, C++ or Rust. Here is the +polymorphic definition of lists from the standard library: + +```juvix +infixr 5 ::; +type List (A : Type) := +| nil : List A +| :: : A -> List A -> List A; +``` + +The constructor `::` is declared as a right-associative infix operator +with priority 5. The definition has a parameter `A` which is the element +type. + +Now one can define the `map` function polymorphically: + +```juvix +map : {A B : Type} -> (A -> B) -> List A -> List B; +map f nil := nil; +map f (h :: hs) := f h :: map f hs; +``` + +This function has two _implicit type arguments_ `A` and `B`. These +arguments are normally omitted in function application – they are +inferred automatically during type checking. The curly braces indicate +that the argument is implicit and should be inferred. + +In fact, the constructors `nil` and `::` also have an implicit argument: +the type of list elements. All type parameters of a data type definition +become implicit arguments of the constructors. + +Usually, the implicit arguments in a function application can be +inferred. However, sometimes this is not possible and then the implicit +arguments need to be provided explicitly by enclosing them in braces: + +```juvix +f {implArg1} .. {implArgK} arg1 .. argN +``` + +For example, `nil {Nat}` has type `List Nat` while `nil` by itself has +type `{A : Type} -> List A`. + +## Tail recursion + +Any recursive call whose result is further processed by the calling +function needs to create a new stack frame to save the calling function +environment. This means that each such call will use a constant amount +of memory. For example, a function `sum` implemented as follows will use +an additional amount of memory proportional to the length of the +processed list: + +```juvix +sum : NList -> Nat; +sum nnil := 0; +sum (ncons x xs) := x + sum xs; +``` + +This is not acceptable if you care about performance. In an imperative +language, one would use a simple loop going over the list without any +memory allocation. In pseudocode: + +```juvix +var sum : Nat := 0; +while (lst /= nnil) { + sum := sum + head lst; + lst := tail lst; +}; +return sum; +``` + +Fortunately, it is possible to rewrite this function to use _tail +recursion_. A recursive call is _tail recursive_ if its result is also +the result of the calling function, i.e., the calling function returns +immediately after it without further processing. The Juvix compiler +_guarantees_ that all tail calls will be eliminated, i.e., that they +will be compiled to simple jumps without extra memory allocation. In a +tail recursive call, instead of creating a new stack frame, the old one +is reused. + +The following implementation of `sum` uses tail recursion. + +```juvix +sum : NList -> Nat; +sum lst := + let + go : Nat -> NList -> Nat; + go acc nnil := acc; + go acc (ncons x xs) := go (acc + x) xs; + in + go 0 lst; +``` + +The first argument of `go` is an _accumulator_ which holds the sum +computed so far. It is analogous to the `sum` variable in the imperative +loop above. The initial value of the accumulator is 0. The function `go` +uses only constant additional memory overall. The code generated for it +by the Juvix compiler is equivalent to an imperative loop. + +Most imperative loops may be translated into tail recursive functional +programs by converting the locally modified variables into accumulators +and the loop condition into pattern matching. For example, here is an +imperative pseudocode for computing the nth Fibonacci number in linear +time. The variables `cur` and `next` hold the last two computed +Fibonacci numbers. + +```juvix +var cur : Nat := 0; +var next : Nat := 1; +while (n /= 0) { + var tmp := next; + next := cur + next; + cur := tmp; + n := n - 1; +}; +return cur; +``` + +An equivalent functional program is: + +```juvix +fib : Nat -> Nat; +fib := + let go : Nat -> Nat -> Nat -> Nat; + go cur _ zero := cur; + go cur next (suc n) := go next (cur + next) n; + in + go 0 1; +``` + +A naive definition of the Fibonacci function runs in exponential time: + +```juvix +fib : Nat -> Nat; +fib zero := 0; +fib (suc zero) := 1; +fib (suc (suc n)) := fib n + fib (suc n); +``` + +Tail recursion is less useful when the function needs to allocate memory +anyway. For example, one could make the `map` function from the previous +section tail recursive, but the time and memory use would still be +proportional to the length of the input because of the need to allocate +the result list. + +## Totality checking + +By default, the Juvix compiler requires all functions to be total. +Totality consists of: + +- [termination](../explanations/totality/termination.md), +- [coverage](../explanations/totality/coverage.md), +- [strict positivity](../explanations/totality/positive.md). + +The termination check ensures that all functions are structurally +recursive, i.e., all recursive call are on structurally smaller value – +subpatterns of the matched pattern. For example, the termination checker +rejects the definition + +```juvix +fact : Nat -> Nat; +fact x := if (x == 0) 1 (x * fact (sub x 1)); +``` + +because the recursive call is not on a subpattern of a pattern matched +on in the clause. One can reformulate this definition so that it is +accepted by the termination checker: + +```juvix +fact : Nat -> Nat; +fact zero := 1; +fact x@(suc n) := x * fact n; +``` + +Sometimes, such a reformulation is not possible. Then one can use the +`terminating` keyword to forgoe the termination check. + +```juvix +terminating +log2 : Nat -> Nat; +log2 n := if (n <= 1) 0 (suc (log2 (div n 2))); +``` + +Coverage checking ensures that there are no unhandled patterns in +function clauses or `case` expressions. For example, the following +definition is rejected because the case `suc zero` is not handled: + +```juvix +even : Nat -> Bool; +even zero := true; +even (suc (suc n)) := even n; +``` + +NOTE: Coverage checking will be implemented only in Juvix version 0.4. +Earlier versions of Juvix accept non-exhaustive patterns. + +## Exercises + +You have now learnt the very basics of Juvix. To consolidate your +understanding of Juvix and functional programming, try doing some of the +following exercises. To learn how to write more complex Juvix programs, +see the [advanced +tutorial](https://docs.juvix.org/examples/html/Tutorial/Tutorial.html) +and the [Juvix program examples](../reference/examples.md). + +1. Define a function `prime : Nat -> Nat` which checks if a given + natural number is prime. + +2. What is wrong with the following definition? + + ```juvix + half : Nat -> Nat; + half n := if (n < 2) 0 (half (n - 2) + 1); + ``` + + How can you reformulate this definition so that it is accepted by + Juvix? + +3. Define a polymorphic function which computes the last element of a + list. What is the result of your function on the empty list? + +4. A _suffix_ of a list `l` is any list which can be obtained from `l` + by removing some initial elements. For example, the suffixes of + `1 :: 2 :: 3 :: nil` are: `1 :: 2 :: 3 :: nil`, `2 :: 3 :: nil`, + `3 :: nil` and `nil`. + + Define a function which computes the list of all suffixes of a given + list in the order of decreasing length. + +5. Recall the `Tree` type from above. + + ```juvix + type Tree := + | leaf : Nat -> Tree + | node : Nat -> Tree -> Tree -> Tree; + ``` + + Analogously to the `map` function for lists, define a function + + ```juvix + tmap : (Nat -> Nat) -> Tree -> Tree + ``` + + which applies a function to all natural numbers stored in a tree. + +6. Make the `Tree` type polymorphic in the element type and repeat the + previous exercise. + +7. Write a tail recursive function which reverses a list. + +8. Write a tail recursive function which computes the factorial of a + natural number. + +9. Define a function `comp : {A : Type} -> List (A -> A) -> A -> A` + which composes all functions in a list. For example, + + ```juvix + comp (suc :: (*) 2 :: \{x := sub x 1} :: nil) + ``` + + should be a function which given `x` computes `2(x - 1) + 1`. diff --git a/docs/tutorials/nodejs-interop.md b/docs/tutorials/nodejs-interop.md new file mode 100644 index 000000000..af1f259b4 --- /dev/null +++ b/docs/tutorials/nodejs-interop.md @@ -0,0 +1,101 @@ +# NodeJS Interop + +A Juvix module can be compiled to a Wasm module. When a Wasm module is +instantiated by a host, functions from the host can be injected into a +Wasm module and functions from the Wasm module can be called by the +host. + +In this tutorial you will see how to call host functions in Juvix and +call Juvix functions from the host using the Wasm mechanism. + +## The Juvix module + +The following Juvix module has two functions. + +The function `hostDisplayString` is an `axiom` with no corresponding +`compile` block that implements it. We will inject an implementation for +this function when we instantiate the module from NodeJS. + +The function `juvixRender` is a normal Juvix function. We will call this +from NodeJS. + + -- NodeJsInterop.juvix + module NodeJsInterop; + + open import Stdlib.Prelude; + + axiom hostDisplayString : String → IO; + + juvixRender : IO; + juvixRender := hostDisplayString "Hello World from Juvix!"; + + end; + +## Compiling the Juvix module + +The Juvix module can be compiled using the following command: + + juvix compile -t wasm -r standalone NodeJsInterop.juvix + +This will create a file containing a Wasm module called +`NodeJsInterop.wasm`. + +## The NodeJS module + +The following NodeJS module demonstrates both calling a Juvix function +from NodeJS and injecting a NodeJS function into a Juvix module. + +The NodeJS function `hostDisplayString` is passed to the Wasm module +`NodeJSInterop.wasm` when it is instantiated. After instantiation the +Juvix function `juvixRender` is called. + +The functions `ptrToCstr` and `cstrlen` are necessary to convert the +`char` pointer passed from Juvix to a JS `String`. + + // NodeJSInterop.js + const fs = require('fs'); + let wasmModule = null; + + function cstrlen(mem, ptr) { + let len = 0; + while (mem[ptr] != 0) { + len++; + ptr++; + } + return len; + } + + function ptrToCstr(ptr) { + const wasmMemory = wasmModule.instance.exports.memory.buffer; + const mem = new Uint8Array(wasmMemory); + const len = cstrlen(mem, ptr); + const bytes = new Uint8Array(wasmMemory, ptr, len); + return new TextDecoder().decode(bytes); + } + + function hostDisplayString(strPtr) { + const text = ptrToCstr(strPtr); + console.log(text); + } + + const wasmBuffer = fs.readFileSync("NodeJsInterop.wasm"); + WebAssembly.instantiate(wasmBuffer, { + env: { + hostDisplayString, + } + }).then((w) => { + wasmModule = w; + wasmModule.instance.exports.juvixRender(); + }); + +## Running the Wasm module + +Now you should have the files `NodeJsInterop.wasm` and +`NodeJsInterop.js` in the same directory. Run the following command to +execute the module: + + node NodeJsInterop.js + +You should see the following output: + + Hello World from Juvix! diff --git a/docs/org/tutorials/structure.org b/docs/tutorials/structure.md similarity index 100% rename from docs/org/tutorials/structure.org rename to docs/tutorials/structure.md diff --git a/docs/org/tutorials/vscode.org b/docs/tutorials/vscode.md similarity index 68% rename from docs/org/tutorials/vscode.org rename to docs/tutorials/vscode.md index 674648230..dc06c1fc3 100644 --- a/docs/org/tutorials/vscode.org +++ b/docs/tutorials/vscode.md @@ -1,14 +1,12 @@ -* Juvix VSCode extension tutorial +# Juvix VSCode extension tutorial -To install the Juvix VSCode extension, click on the "Extensions" -button in the left panel and search for the "Juvix" extension by -Heliax. +To install the Juvix VSCode extension, click on the "Extensions" button +in the left panel and search for the "Juvix" extension by Heliax. -Once you've installed the Juvix extension, you can open a Juvix -file. For example, create a =Hello.juvix= file with the following -content. +Once you've installed the Juvix extension, you can open a Juvix file. +For example, create a `Hello.juvix` file with the following content. -#+begin_example +```juvix module Hello; open import Stdlib.Prelude; @@ -17,16 +15,16 @@ main : IO; main := printStringLn "Hello world!"; end; -#+end_example +``` -Syntax should be automatically highlighted for any file with =.juvix= +Syntax should be automatically highlighted for any file with `.juvix` extension. You can jump to the definition of an identifier by pressing F12 or control-clicking it. To apply the Juvix code formatter to the current file, use Shift+Ctrl+I. -In the top right-hand corner of the editor window you should see -several buttons. Hover the mouse pointer over a button to see its -description. The functions of the buttons are as follows. +In the top right-hand corner of the editor window you should see several +buttons. Hover the mouse pointer over a button to see its description. +The functions of the buttons are as follows. - Load file in REPL (Shift+Alt+R). Launches the Juvix REPL in a separate window and loads the current file into it. You can then diff --git a/examples/milestone/TicTacToe/TicTacToe.juvix b/examples/milestone/TicTacToe/TicTacToe.juvix index 8c1a2506a..ad72d40eb 100644 --- a/examples/milestone/TicTacToe/TicTacToe.juvix +++ b/examples/milestone/TicTacToe/TicTacToe.juvix @@ -1,4 +1,3 @@ module TicTacToe; import CLI.TicTacToe; - import Web.TicTacToe; end; diff --git a/package.yaml b/package.yaml index a14592cd5..e40e5de17 100644 --- a/package.yaml +++ b/package.yaml @@ -1,119 +1,126 @@ -name: juvix -version: 0.3.0 -license: GPL-3.0-only -license-file: LICENSE -copyright: (c) 2022- Heliax AG. -maintainer: The PLT Team at Heliax AG -author: [ Jonathan Prieto-Cubides , Jan Mas Rovira , Paul Cadman , Lukasz Czajka , Github's contributors ] -tested-with: ghc == 9.2.6 -homepage: https://juvix.org -bug-reports: https://github.com/anoma/juvix/issues -description: The Juvix compiler -category: Compilers/Interpreters -github: anoma/juvix +name: juvix +version: 0.3.0 +license: GPL-3.0-only +license-file: LICENSE.md +copyright: (c) 2022- Heliax AG. +maintainer: The PLT Team at Heliax AG +author: + [ + Jonathan Prieto-Cubides, + Jan Mas Rovira, + Paul Cadman, + Lukasz Czajka, + Github's contributors, + ] +tested-with: ghc == 9.2.6 +homepage: https://juvix.org +bug-reports: https://github.com/anoma/juvix/issues +description: The Juvix compiler +category: Compilers/Interpreters +github: anoma/juvix extra-source-files: -- README.org -- assets/css/*.css -- assets/js/*.js -- assets/images/*.svg -- assets/images/*.png -- juvix-stdlib/juvix.yaml -- juvix-stdlib/**/*.juvix -- runtime/include/**/*.h -- runtime/**/*.a + - README.md + - assets/css/*.css + - assets/js/*.js + - assets/images/*.svg + - assets/images/*.png + - juvix-stdlib/juvix.yaml + - juvix-stdlib/**/*.juvix + - runtime/include/**/*.h + - runtime/**/*.a dependencies: -- aeson == 2.0.* -- aeson-better-errors == 0.9.* -- ansi-terminal == 0.11.* -- base == 4.16.* -- blaze-html == 0.9.* -- bytestring == 0.11.* -- containers == 0.6.* -- directory == 1.3.* -- dlist == 1.0.* -- edit-distance == 0.2.* -- exceptions == 0.10.* -- extra == 1.7.* -- file-embed == 0.0.* -- filepath == 1.4.* -- gitrev == 1.3.* -- hashable == 1.4.* -- language-c == 0.9.* -- megaparsec == 9.2.* -- microlens-platform == 0.4.* -- parser-combinators == 1.3.* -- path == 0.9.* -- path-io == 1.7.* -- polysemy == 1.7.* -- polysemy-plugin == 0.4.* -- pretty == 1.1.* -- prettyprinter == 1.7.* -- prettyprinter-ansi-terminal == 1.1.* -- process == 1.6.* -- safe == 0.3.* -- singletons == 3.0.* -- singletons-th == 3.1.* -- Stream == 0.4.* -- template-haskell == 2.18.* -- text == 1.2.* -- th-utilities == 0.2.* -- time == 1.11.* -- transformers == 0.5.* -- uniplate == 1.6.* -- unix-compat == 0.5.* -- unordered-containers == 0.2.* -- utf8-string == 1.0.* -- versions == 5.0.* -- yaml == 0.11.* + - aeson == 2.0.* + - aeson-better-errors == 0.9.* + - ansi-terminal == 0.11.* + - base == 4.16.* + - blaze-html == 0.9.* + - bytestring == 0.11.* + - containers == 0.6.* + - directory == 1.3.* + - dlist == 1.0.* + - edit-distance == 0.2.* + - exceptions == 0.10.* + - extra == 1.7.* + - file-embed == 0.0.* + - filepath == 1.4.* + - gitrev == 1.3.* + - hashable == 1.4.* + - language-c == 0.9.* + - megaparsec == 9.2.* + - microlens-platform == 0.4.* + - parser-combinators == 1.3.* + - path == 0.9.* + - path-io == 1.7.* + - polysemy == 1.7.* + - polysemy-plugin == 0.4.* + - pretty == 1.1.* + - prettyprinter == 1.7.* + - prettyprinter-ansi-terminal == 1.1.* + - process == 1.6.* + - safe == 0.3.* + - singletons == 3.0.* + - singletons-th == 3.1.* + - Stream == 0.4.* + - template-haskell == 2.18.* + - text == 1.2.* + - th-utilities == 0.2.* + - time == 1.11.* + - transformers == 0.5.* + - uniplate == 1.6.* + - unix-compat == 0.5.* + - unordered-containers == 0.2.* + - utf8-string == 1.0.* + - versions == 5.0.* + - yaml == 0.11.* -# the tasty dependencies are here to avoid having to recompile -# juvix when running the tests. -- tasty -- tasty-hunit -- Diff == 0.4.* -- pretty-show == 1.10.* + # the tasty dependencies are here to avoid having to recompile + # juvix when running the tests. + - tasty + - tasty-hunit + - Diff == 0.4.* + - pretty-show == 1.10.* -# benchmarks -- criterion == 1.5.* -- statistics == 0.16.* -- shake == 0.19.* -- colour == 2.3.* -- palette == 0.3.* + # benchmarks + - criterion == 1.5.* + - statistics == 0.16.* + - shake == 0.19.* + - colour == 2.3.* + - palette == 0.3.* ghc-options: -# Warnings -- -Weverything -- -Wno-all-missed-specialisations -- -Wno-missing-export-lists -- -Wno-missing-import-lists -- -Wno-missing-kind-signatures -- -Wno-missing-safe-haskell-mode -- -Wno-safe -- -Wno-unsafe -- -Wno-unused-packages -# HIE Support -- -fhide-source-paths -- -fwrite-ide-info -hiedir=.hie -# Polysemy Support -- -O2 -flate-specialise -fspecialise-aggressively + # Warnings + - -Weverything + - -Wno-all-missed-specialisations + - -Wno-missing-export-lists + - -Wno-missing-import-lists + - -Wno-missing-kind-signatures + - -Wno-missing-safe-haskell-mode + - -Wno-safe + - -Wno-unsafe + - -Wno-unused-packages + # HIE Support + - -fhide-source-paths + - -fwrite-ide-info -hiedir=.hie + # Polysemy Support + - -O2 -flate-specialise -fspecialise-aggressively default-extensions: -- ApplicativeDo -- DataKinds -- DerivingStrategies -- GADTs -- GeneralizedNewtypeDeriving -- ImportQualifiedPost -- LambdaCase -- MultiWayIf -- NoFieldSelectors -- NoImplicitPrelude -- OverloadedStrings -- RecordWildCards -- TemplateHaskell -- TypeFamilyDependencies + - ApplicativeDo + - DataKinds + - DerivingStrategies + - GADTs + - GeneralizedNewtypeDeriving + - ImportQualifiedPost + - LambdaCase + - MultiWayIf + - NoFieldSelectors + - NoImplicitPrelude + - OverloadedStrings + - RecordWildCards + - TemplateHaskell + - TypeFamilyDependencies library: source-dirs: src @@ -125,30 +132,30 @@ executables: main: Main.hs source-dirs: app dependencies: - - juvix - - haskeline == 0.8.* - - http-conduit == 2.3.* - - mtl == 2.2.* - - optparse-applicative == 0.17.* - - repline == 0.4.* - - string-interpolate == 0.3.* + - juvix + - haskeline == 0.8.* + - http-conduit == 2.3.* + - mtl == 2.2.* + - optparse-applicative == 0.17.* + - repline == 0.4.* + - string-interpolate == 0.3.* verbatim: default-language: GHC2021 tests: juvix-test: - main: Main.hs - source-dirs: test + main: Main.hs + source-dirs: test dependencies: - - juvix + - juvix verbatim: default-language: GHC2021 benchmarks: juvix-bench: - main: Main.hs - source-dirs: bench + main: Main.hs + source-dirs: bench dependencies: - - juvix + - juvix verbatim: default-language: GHC2021 diff --git a/theme/index.hbs b/theme/index.hbs new file mode 100644 index 000000000..3961d6ffa --- /dev/null +++ b/theme/index.hbs @@ -0,0 +1,317 @@ + + + + + + {{ title }} + {{#if is_print }} + + {{/if}} + {{#if base_url}} + + {{/if}} + + + + {{> head}} + + + + + + {{#if favicon_svg}} + + {{/if}} + {{#if favicon_png}} + + {{/if}} + + + + {{#if print_enable}} + + {{/if}} + + + + {{#if copy_fonts}} + + {{/if}} + + + + + + + + {{#each additional_css}} + + {{/each}} + + {{#if mathjax_support}} + + + {{/if}} + + +
+ + + + + + + + + + + + + + +
+ +
+ {{> header}} + + + + {{#if search_enabled}} + + {{/if}} + + + + +
+
+ {{{ content }}} +
+ + +
+
+ + + +
+ + {{#if live_reload_endpoint}} + + + {{/if}} + + {{#if google_analytics}} + + + {{/if}} + + {{#if playground_line_numbers}} + + {{/if}} + + {{#if playground_copyable}} + + {{/if}} + + {{#if playground_js}} + + + + + + {{/if}} + + {{#if search_js}} + + + + {{/if}} + + + + + + + {{#each additional_js}} + + {{/each}} + + {{#if is_print}} + {{#if mathjax_support}} + + {{else}} + + {{/if}} + {{/if}} + +
+ + diff --git a/theme/latex-macros.txt b/theme/latex-macros.txt new file mode 100644 index 000000000..e69de29bb diff --git a/theme/pagetoc.css b/theme/pagetoc.css new file mode 100644 index 000000000..98968f503 --- /dev/null +++ b/theme/pagetoc.css @@ -0,0 +1,57 @@ +@media only screen and (max-width: 1439px) { + .sidetoc { + display: none; + } +} + +@media only screen and (min-width: 1440px) { + main { + position: relative; + } + .sidetoc { + margin-left: auto; + margin-right: auto; + left: calc(100% + (var(--content-max-width)) / 4 - 140px); + position: absolute; + } + .pagetoc { + position: fixed; + width: 200px; + height: calc(100vh - var(--menu-bar-height) - 0.67em * 4); + overflow: auto; + } + .pagetoc a { + border-left: 1px solid var(--sidebar-bg); + color: var(--fg) !important; + display: block; + padding-bottom: 5px; + padding-top: 5px; + padding-left: 10px; + text-align: left; + text-decoration: none; + } + .pagetoc a:hover, + .pagetoc a.active { + background: var(--sidebar-bg); + color: var(--sidebar-fg) !important; + } + .pagetoc .active { + background: var(--sidebar-bg); + color: var(--sidebar-fg); + } + .pagetoc .pagetoc-H2 { + padding-left: 20px; + } + .pagetoc .pagetoc-H3 { + padding-left: 40px; + } + .pagetoc .pagetoc-H4 { + padding-left: 60px; + } + .pagetoc .pagetoc-H5 { + display: none; + } + .pagetoc .pagetoc-H6 { + display: none; + } +} diff --git a/theme/pagetoc.js b/theme/pagetoc.js new file mode 100644 index 000000000..4f4544998 --- /dev/null +++ b/theme/pagetoc.js @@ -0,0 +1,58 @@ +// Un-active everything when you click it +Array.prototype.forEach.call( + document.getElementsByClassName("pagetoc")[0].children, + function (el) { + el.addEventHandler("click", function () { + Array.prototype.forEach.call( + document.getElementsByClassName("pagetoc")[0].children, + function (el) { + el.classList.remove("active"); + }, + ); + el.classList.add("active"); + }); + }, +); + +var updateFunction = function () { + var id; + var elements = document.getElementsByClassName("header"); + Array.prototype.forEach.call(elements, function (el) { + if (window.pageYOffset >= el.offsetTop) { + id = el; + } + }); + + Array.prototype.forEach.call( + document.getElementsByClassName("pagetoc")[0].children, + function (el) { + el.classList.remove("active"); + }, + ); + if (!id) return; + Array.prototype.forEach.call( + document.getElementsByClassName("pagetoc")[0].children, + function (el) { + if (id.href.localeCompare(el.href) == 0) { + el.classList.add("active"); + } + }, + ); +}; + +// Populate sidebar on load +window.addEventListener("load", function () { + var pagetoc = document.getElementsByClassName("pagetoc")[0]; + var elements = document.getElementsByClassName("header"); + Array.prototype.forEach.call(elements, function (el) { + var link = document.createElement("a"); + link.appendChild(document.createTextNode(el.text)); + link.href = el.href; + link.classList.add("pagetoc-" + el.parentElement.tagName); + pagetoc.appendChild(link); + }); + updateFunction.call(); +}); + +// Handle active elements on scroll +window.addEventListener("scroll", updateFunction);