The current Github action responsible for installing Wasmer fails from
time to time, and it also is outdated, not following the new NodeJS 16
requirement by Github.
We could use https://github.com/jaxxstorm/action-install-gh-release
instead, but unfortunately, it does not have the proper support to
expose the binaries contained in an inner folder, as in the case with
the Wasmer release. In the meantime, let's use my
[fork](https://github.com/jonaprieto/action-install-gh-release) while I
open PR to the main repository.
This PR adds some maintenance at different levels to the CI config, the
Make file, and formatting.
- Most of the actions used by the CI related to haskell, ormolu, hlint
and pre-commit have been updated because Github requires NodeJS 16. This
change removes all the old warnings related to nodeJs.
In the case of ormolu, the new version makes us format some files that
were not formatted before, similarly with hlint.
- The CI has been updated to use the latest version of the Smoke testing
framework, which introduced installation of the dependencies for Linux
(libicu66) and macOS (icu4c) in the CI. In the case of macOS, the CI
uses a binary for smoke. For Linux, we use stack to build smoke from the
source. The source here is in a fork of [the official Smoke
repo](https://github.com/SamirTalwar/smoke). Such includes some
features/changes that are not yet in the official repo.
- The Makefile runs the ormolu and hlint targets using as a path for the
binaries the environment variables ORMOLU and HLINT. Thus, export those
variables in your environment before running `make check,` `make format`
or `make hlint`. Otherwise, the Makefile will use the binaries provided
by `stack`.
Co-authored-by: Paul Cadman <git@paulcadman.dev>
We need to use the homebrew Clang/LLVM installation to build the Juvix
runtime because macOS ships with a version of Clang/LLVM that does not
support the wasi target.
The GitHub action runner agent has the homebrew packaged Clang/LLVM
installed but it is not on the shell PATH.
We were using `brew --prefix llvm@14` to point to the homebrew
Clang/LLVM installation. However this breaks when the runner image is
updated to a new version of llvm.
So we switch to using `brew --prefix llvm` which will resolve to the
latest (and in this case only) version of homebrew Clang/LLVM. This will
be stable when Clang/LLVM is updated to a new version.
This PR adds smoke tests using [Smoke
tool](https://github.com/SamirTalwar/smoke) for all the shell tests we
have. One reason for adopting Smoke instead of the previous tool,
`shelltestrunner`, is that tests are declared cleanly and simply using
Smoke Yaml syntax compared to shelltestrunner's syntax.
To add a new smoke test, create a file with the suffix ".smoke.yaml" in
the `tests/smoke` folder. In such a folder, you can also find examples
of how to test the CLI.
* Pin mdbook to 0.4.22
mdbook homebrew version (used by the github action to install mdbook)
was bumped to 0.4.23
eb69fcddba
which seems to be incompatible with Ubuntu 20.04 glibc
* Temporarily enable docs build on PRs
* Revert "Temporarily enable docs build on PRs"
This reverts commit e2cf41016c.
* upgrade stack snapshot to use ghc-9.2.5
* use lts-20.2
* Update alpine GHC Dockerfile to 9.2.5
We also build the Juvix runtime before the stack build in the
linux-static-binary workflow file.
* Add some documentation on how to build and deploy the alpine GHC image
* Docker documentation clarification.
Co-authored-by: Paul Cadman <git@paulcadman.dev>
This error occurs when building with stack:
```
Run stack install --system-ghc --ghc-options='-split-sections -optl-static'
4
Preventing creation of stack root '/github/home/.stack/'. Parent directory '/github/home/' is owned by someone else.
5
Error: Process completed with exit code 1.
```
https://github.com/commercialhaskell/stack/issues/2187
* Add a Web version of TicTacToe
The web version demonstrates injecting host functions into the WASM
import table and call exported Juvix functions from JS.
The web version and the CLI version of the TicTacToe game use the same
game logic backend Juvix module.
* Build and publish web apps in documentation
* Add a link to the TicTacToe web app in example documentation
* Update Makefile to match the new format
* Documment a few language features
* Add an example for foreign example
* Fix pre-commit warnings
* remove what-is-org
* Ignore README.org in docs folder
* Add fixes for revisions
* html-examples
* Fix Makefile
* Fix yaml file
* [ci] add main to the path
* install juvix
* Add Collatz and fix cname in the CI
* Add Collatz file name
* Add deleted file and and uncomment cond in the CI
* Renaming MiniJuvix to Juvix
* Make Ormolu happy
* Make Hlint happy
* Remove redundant imports
* Fix shell tests and add target ci to our Makefile
* Make pre-commit happy
* Embed stdlib in minijuvix library
We add a new step at the beginning of the pipeline called Setup that
registers the modules in the standard library with the Files effect. The
standard library is then used when the Scoper queries the Files effect
for modules as it resolves import statements.
Use of the standard library can be disabled using the global
`--no-stdlib` command-line option.
* CI: Checkout submodules recursively for stdlib
* Add a new `--no-stdlib` option to shell check
* Poke CI
* CI: Checkout submodules in the test job
* match inductive definitions
* progress towards builtins
* more progress towards builtin types
* add more builtins
* add some errors
* add reverse table to builtins
* Squashed commit of the following:
commit 93333de502d8dd546eb8edf697ca7eef972ea105
Author: Paul Cadman <git@paulcadman.dev>
Date: Mon Jun 27 18:21:30 2022 +0100
Use builtin names for match and project functions
Add an implementation of nat for the standalone backend
commit 868d2098ee57b7acbca84512b6e096650eeeb22d
Author: Jan Mas Rovira <janmasrovira@gmail.com>
Date: Mon Jun 27 18:15:29 2022 +0200
add builtin information to ClosureInfo
commit 32c78aceb19ee4010d66090a3c4e6025621b5c1f
Author: Paul Cadman <git@paulcadman.dev>
Date: Mon Jun 27 12:52:10 2022 +0100
Refactor BuiltinEnum to sum type of each Builtin
commit 55bb72ab12a8fb7d10070c2dee5875482453b7c6
Author: Paul Cadman <git@paulcadman.dev>
Date: Fri Jun 24 14:44:28 2022 +0100
Add Builtin information to Mono InfoTable
commit a72368f2e3af20baaf44c5e21fa7e6a469cf1ac5
Author: Paul Cadman <git@paulcadman.dev>
Date: Fri Jun 24 14:41:51 2022 +0100
Add Bitraversable to Prelude
commit afa3153d82a9509b0882e7ca99830040fad9ef65
Author: Paul Cadman <git@paulcadman.dev>
Date: Fri Jun 24 14:41:39 2022 +0100
Remove unused import
commit ea0b7848fb80970e03a0561be3fb4448486a89a9
Author: Paul Cadman <git@paulcadman.dev>
Date: Thu Jun 23 13:54:58 2022 +0100
Use projection functions instead of direct member access
* Avoid shadowing C runtime names in foreign block
* Fix formatting
* Update C names for builtin functions
* Add prim_ prefix to builtin C names
Implement builtins for standalone and libc backends
* Update ormolu action
* ci: run all tests for draft PRs
Co-authored-by: Paul Cadman <git@paulcadman.dev>
* upgrade to ghc-9.2.3
* [ci] build with ghc 9.2.3
* Remove the gcc alises added by LLVM install
The GHC installer (initiated by stack in the test step) requires access
to GCC because it uses the GCC specific `--gc-sections` linker flag.
We remove the gcc -> clang symlink, our tests use the clang binary
directly and so do not require the symlink.
* Run GCC PATH fixup step on macOS only
* Fixes YAML quote marks
* Install GHC via stack setup before installing LLVM
Having both macOS LLVM and stock LLVM on the PATH causes the GHC
installation to fail.
Co-authored-by: Jonathan Cubides <jonathan.cubides@uib.no>
Co-authored-by: Paul Cadman <git@paulcadman.dev>
* work in progress towards implicit arguments
* Wip towards implicit types
* improve arity checker
* Add version of SimpleFungibleToken with implicit arguments
* guess arity of body before checking the lhs of a clause
* add ArityUnknown and fix some tests
* wip: proper errors in arity checker
* fix bugs, improve errors and add tests
* format
* set hlint version to 3.4 in the ci
* update pre-commit version to 3.0.0
* minor changes
* added more revisions
* minor
Co-authored-by: Jonathan Cubides <jonathan.cubides@uib.no>
* Remove input file fields from command opts
* [cli] Make version and help commands
* Fix on reviews
* Fixes for dealing with global options inside subcmds
* Fix minijuvix emacs mode and add some instance to GlobalOpts
* Remove unrelated code
* Propagate globals opts in each cmd parser
* Add initial shell tests
* Add test-shell to makefile and CI
* Fix CI: adding .local/bin to PATH
* Fixing CI
* Installing shelltest just before running it
* Install app for shell testing
* Hide global flags after cmd. Fix shell tests accordingly.
* Fixing CI
* Shell test only run on ubuntu for now
* w.i.p adoption of generic error type
* harmonize
* Remove the use of Error effect for internal bugs
* add location information to expression atom list
* Add GenericError instance for PatternAtoms
* Remove Maybe GenericError occurrences
* [ci] fix draft job's condition
* minor changes
* [stack] macos support ghc-opts
* Fix reviewer's comments
* remove accidentally commited file
* refactor to avoid duplication
* fix
Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
* Make CI even more pedantic
* remove aeson dependency
Co-authored-by: Paul Cadman <pcadman@gmail.com>
Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
* [cbackend] Adds an AST for C
This should cover enough C to implement the microjuvix backend.
* [cbackend] Add C serializer using language-c library
We may decide to write our own serializer for the C AST but this
demonstrates that the C AST is sufficient at least.
* [cbackend] Declarations will always be typed
* [cbackend] Add CPP support to AST
* [cbackend] Rename some names for clarity
* [cbackend] Add translation of InductiveDef to C
* [cbackend] Add CLI for C backend
* [cbackend] Add stdbool.h to file header
* [cbackend] Allow Cpp and Verbatim code inline
* [cbackend] Add a newline after printing C
* [cbackend] Support foreign blocks
* [cbackend] Add support for axioms
* [cbackend] Remove code examples
* [cbackend] wip FunctionDef including Expressions
* [parser] Support esacping '}' inside a foreign block
* [cbackend] Add support for patterns in functions
* [cbackend] Add foreign C support to HelloWorld.mjuvix
* hlint fixes
* More hlint fixes not picked up by pre-commit
* [cbackend] Remove CompileStatement from MonoJuvix
* [cbackend] Add support for compile blocks
* [cbackend] Move compileInfo extraction to MonoJuvixResult
* [minihaskell] Fix compile block support
* [chore] Remove ununsed isBackendSupported function
* [chore] Remove unused imports
* [cbackend] Use a Reader for pattern bindings
* [cbackend] Fix compiler warnings
* [cbackend] Add support for nested patterns
* [cbackend] Use functions to instantiate argument names
* [cbackend] Add non-exhaustive pattern error message
* [cbackend] Adds test for c to WASM compile and execution
* [cbackend] Add links to test dependencies in quickstart
* [cbackend] Add test with inductive types and patterns
* [cbackend] Fix indentation
* [cbackend] Remove ExpressionTyped case
https://github.com/heliaxdev/minijuvix/issues/79
* [lexer] Fix lexing of \ inside a foreign block
* [cbackend] PR review fixes
* [chore] Remove unused import
* [cbackend] Rename CJuvix to MiniC
* [cbackend] Rename MonoJuvixToC to MonoJuvixToMiniC
* [cbackend] Add test for polymorphic function
* [cbackend] Add module for string literals