1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-18 04:11:47 +03:00
juvix/package.yaml

196 lines
4.2 KiB
YAML
Raw Normal View History

name: juvix
version: 0.5.5
license: GPL-3.0-only
license-file: LICENSE.md
copyright: (c) 2022- Heliax AG.
maintainer: The Compilers Team at Heliax AG <hello@heliax.dev>
author:
[
Jonathan Prieto-Cubides,
Jan Mas Rovira,
Paul Cadman,
Lukasz Czajka,
Github's contributors,
]
Update stackage resolver to LTS 21.6 (#2275) Stack LTS 21.6 uses GHC 9.4.5, binaries for HLS are available via ghcup. Changes required: 1. Fix warnings about type level `:` and `[]` used without backticks. 2. Fix warnings about deprecation of builtin `~` - replaced with `import Data.Type.Equality ( type (~) )` in the Prelude 3. SemVer is no longer a monoid 4. `path-io` now contains the `AnyPath` instances we were defining (thanks to Jan) so they can be removed. 5. Added `aeson-better-errors-0.9.1.1` as an extra-dep. The reason it is not part of the resolver is only because it has a strict bound on base which is not compatible with ghc 9.4.5. To work around this I've set: ``` allow-newer: true allow-newer-deps: - aeson-better-errors ``` which relaxed the upper constraint bounds for `aeson-better-errors` only. When the base constraints have been updated we can remove this workaround. 6. Use stack2cabal to generate the cabal.project file and to freeze dependency versions. https://www.stackage.org/lts-21.6/cabal.config now contains the constraint `haskeline installed`, which means that the version of haskeline that is globally installed with GHC 9.4.5 will be used, see: * https://github.com/commercialhaskell/stackage/issues/7002 GHC 9.4.5 comes with haskeline 0.8.2 preinstalled but our configuration contains the source-repository-package for haskeline 0.8.2.1 (required because we're using a fork) so if you try to run` cabal build` you get a conflict. Constraints from cabal imports cannot yet be overridden so it's not possible to get rid of this conflict using the import method. So we need to use stack2cabal with an explicit freeze file instead. 7. Remove `runTempFilePure` as this is unused and depends on `Polysemy.Fresh` in `polysemy-zoo` which is not available in the resolver. It turns out that it's not possible to use the `Fresh` effect in a pure context anyway, so it was not possible to use `runTempFilePure` for its original purpose. 8. We now use https://github.com/benz0li/ghc-musl as the base container for static linux builds, this means we don't need to maintain our own Docker container for this purpose. 9. The PR for the nightly builds is ready https://github.com/anoma/juvix-nightly-builds/pull/2, it should be merged as soon as this PR is merged. Thanks to @benz0li for maintaining https://github.com/benz0li/ghc-musl and (along with @TravisCardwell) for help with building the static binary. * Closes https://github.com/anoma/juvix/issues/2166
2023-08-11 12:49:33 +03:00
tested-with: ghc == 9.4.5
homepage: https://juvix.org
bug-reports: https://github.com/anoma/juvix/issues
description: The Juvix compiler
category: Compilers/Interpreters
github: anoma/juvix
2021-12-23 12:57:55 +03:00
Update stackage resolver to LTS 21.6 (#2275) Stack LTS 21.6 uses GHC 9.4.5, binaries for HLS are available via ghcup. Changes required: 1. Fix warnings about type level `:` and `[]` used without backticks. 2. Fix warnings about deprecation of builtin `~` - replaced with `import Data.Type.Equality ( type (~) )` in the Prelude 3. SemVer is no longer a monoid 4. `path-io` now contains the `AnyPath` instances we were defining (thanks to Jan) so they can be removed. 5. Added `aeson-better-errors-0.9.1.1` as an extra-dep. The reason it is not part of the resolver is only because it has a strict bound on base which is not compatible with ghc 9.4.5. To work around this I've set: ``` allow-newer: true allow-newer-deps: - aeson-better-errors ``` which relaxed the upper constraint bounds for `aeson-better-errors` only. When the base constraints have been updated we can remove this workaround. 6. Use stack2cabal to generate the cabal.project file and to freeze dependency versions. https://www.stackage.org/lts-21.6/cabal.config now contains the constraint `haskeline installed`, which means that the version of haskeline that is globally installed with GHC 9.4.5 will be used, see: * https://github.com/commercialhaskell/stackage/issues/7002 GHC 9.4.5 comes with haskeline 0.8.2 preinstalled but our configuration contains the source-repository-package for haskeline 0.8.2.1 (required because we're using a fork) so if you try to run` cabal build` you get a conflict. Constraints from cabal imports cannot yet be overridden so it's not possible to get rid of this conflict using the import method. So we need to use stack2cabal with an explicit freeze file instead. 7. Remove `runTempFilePure` as this is unused and depends on `Polysemy.Fresh` in `polysemy-zoo` which is not available in the resolver. It turns out that it's not possible to use the `Fresh` effect in a pure context anyway, so it was not possible to use `runTempFilePure` for its original purpose. 8. We now use https://github.com/benz0li/ghc-musl as the base container for static linux builds, this means we don't need to maintain our own Docker container for this purpose. 9. The PR for the nightly builds is ready https://github.com/anoma/juvix-nightly-builds/pull/2, it should be merged as soon as this PR is merged. Thanks to @benz0li for maintaining https://github.com/benz0li/ghc-musl and (along with @TravisCardwell) for help with building the static binary. * Closes https://github.com/anoma/juvix/issues/2166
2023-08-11 12:49:33 +03:00
flags:
# This flag can only be used in an environment that contains static libraries
# for all dependencies, including libc We use this when doing a static build
# using the ghc-musl alpine container
static:
description: Build static executable
default: false
manual: true
2021-12-23 12:57:55 +03:00
extra-source-files:
- README.md
- assets/css/*.css
- assets/js/*.js
- assets/images/*.svg
- juvix-stdlib/**/*.juvix
- include/package/**/*.juvix
- include/package-base/**/*.juvix
- runtime/include/**/*.h
- runtime/**/*.a
- runtime/src/vampir/*.pir
2021-12-23 12:57:55 +03:00
dependencies:
- aeson-better-errors == 0.9.*
Update stackage resolver to LTS 21.6 (#2275) Stack LTS 21.6 uses GHC 9.4.5, binaries for HLS are available via ghcup. Changes required: 1. Fix warnings about type level `:` and `[]` used without backticks. 2. Fix warnings about deprecation of builtin `~` - replaced with `import Data.Type.Equality ( type (~) )` in the Prelude 3. SemVer is no longer a monoid 4. `path-io` now contains the `AnyPath` instances we were defining (thanks to Jan) so they can be removed. 5. Added `aeson-better-errors-0.9.1.1` as an extra-dep. The reason it is not part of the resolver is only because it has a strict bound on base which is not compatible with ghc 9.4.5. To work around this I've set: ``` allow-newer: true allow-newer-deps: - aeson-better-errors ``` which relaxed the upper constraint bounds for `aeson-better-errors` only. When the base constraints have been updated we can remove this workaround. 6. Use stack2cabal to generate the cabal.project file and to freeze dependency versions. https://www.stackage.org/lts-21.6/cabal.config now contains the constraint `haskeline installed`, which means that the version of haskeline that is globally installed with GHC 9.4.5 will be used, see: * https://github.com/commercialhaskell/stackage/issues/7002 GHC 9.4.5 comes with haskeline 0.8.2 preinstalled but our configuration contains the source-repository-package for haskeline 0.8.2.1 (required because we're using a fork) so if you try to run` cabal build` you get a conflict. Constraints from cabal imports cannot yet be overridden so it's not possible to get rid of this conflict using the import method. So we need to use stack2cabal with an explicit freeze file instead. 7. Remove `runTempFilePure` as this is unused and depends on `Polysemy.Fresh` in `polysemy-zoo` which is not available in the resolver. It turns out that it's not possible to use the `Fresh` effect in a pure context anyway, so it was not possible to use `runTempFilePure` for its original purpose. 8. We now use https://github.com/benz0li/ghc-musl as the base container for static linux builds, this means we don't need to maintain our own Docker container for this purpose. 9. The PR for the nightly builds is ready https://github.com/anoma/juvix-nightly-builds/pull/2, it should be merged as soon as this PR is merged. Thanks to @benz0li for maintaining https://github.com/benz0li/ghc-musl and (along with @TravisCardwell) for help with building the static binary. * Closes https://github.com/anoma/juvix/issues/2166
2023-08-11 12:49:33 +03:00
- aeson == 2.1.*
- ansi-terminal == 0.11.*
Update stackage resolver to LTS 21.6 (#2275) Stack LTS 21.6 uses GHC 9.4.5, binaries for HLS are available via ghcup. Changes required: 1. Fix warnings about type level `:` and `[]` used without backticks. 2. Fix warnings about deprecation of builtin `~` - replaced with `import Data.Type.Equality ( type (~) )` in the Prelude 3. SemVer is no longer a monoid 4. `path-io` now contains the `AnyPath` instances we were defining (thanks to Jan) so they can be removed. 5. Added `aeson-better-errors-0.9.1.1` as an extra-dep. The reason it is not part of the resolver is only because it has a strict bound on base which is not compatible with ghc 9.4.5. To work around this I've set: ``` allow-newer: true allow-newer-deps: - aeson-better-errors ``` which relaxed the upper constraint bounds for `aeson-better-errors` only. When the base constraints have been updated we can remove this workaround. 6. Use stack2cabal to generate the cabal.project file and to freeze dependency versions. https://www.stackage.org/lts-21.6/cabal.config now contains the constraint `haskeline installed`, which means that the version of haskeline that is globally installed with GHC 9.4.5 will be used, see: * https://github.com/commercialhaskell/stackage/issues/7002 GHC 9.4.5 comes with haskeline 0.8.2 preinstalled but our configuration contains the source-repository-package for haskeline 0.8.2.1 (required because we're using a fork) so if you try to run` cabal build` you get a conflict. Constraints from cabal imports cannot yet be overridden so it's not possible to get rid of this conflict using the import method. So we need to use stack2cabal with an explicit freeze file instead. 7. Remove `runTempFilePure` as this is unused and depends on `Polysemy.Fresh` in `polysemy-zoo` which is not available in the resolver. It turns out that it's not possible to use the `Fresh` effect in a pure context anyway, so it was not possible to use `runTempFilePure` for its original purpose. 8. We now use https://github.com/benz0li/ghc-musl as the base container for static linux builds, this means we don't need to maintain our own Docker container for this purpose. 9. The PR for the nightly builds is ready https://github.com/anoma/juvix-nightly-builds/pull/2, it should be merged as soon as this PR is merged. Thanks to @benz0li for maintaining https://github.com/benz0li/ghc-musl and (along with @TravisCardwell) for help with building the static binary. * Closes https://github.com/anoma/juvix/issues/2166
2023-08-11 12:49:33 +03:00
- base == 4.17.*
- base16-bytestring == 1.0.*
- blaze-html == 0.9.*
- bytestring == 0.11.*
- cereal == 0.5.*
- containers == 0.6.*
- cryptohash-sha256 == 0.11.*
- directory == 1.3.*
- dlist == 1.0.*
- edit-distance == 0.2.*
- exceptions == 0.10.*
- extra == 1.7.*
- file-embed == 0.0.*
Run test suite in parallel (#2507) ## Overview This PR makes the compiler pipeline thread-safe so that the test suite can be run in parallel. This is achieved by: * Removing use of `{get, set, with}CurrentDir` functions. * Adding locking around shared file resources like the the global-project and internal build directory. NB: **Locking is disabled for the main compiler target**, as it is single threaded they are not required. ## Run test suite in parallel To run the test suite in parallel you must add `--ta '+RTS -N -RTS'` to your stack test arguments. For example: ``` stack test --fast --ta '+RTS -N -RTS' ``` The `-N` instructs the Haskell runtime to choose the number of threads to use based on how many processors there are on your machine. You can use `-Nn` to see the number of threads to `n`. These flags are already [set in the Makefile](https://github.com/anoma/juvix/blob/e6dca22cfdcff936add5e7134f9c6f20416504a5/Makefile#L26) when you or CI uses `stack test`. ## Locking The Haskell package [filelock](https://hackage.haskell.org/package/filelock) is used for locking. File locks are used instead of MVars because Juvix code does not control when new threads are created, they are created by the test suite. This means that MVars created by Juvix code will have no effect, because they are created independently on each test-suite thread. Additionally the resources we're locking live on the filesystem and so can be conveniently tagged by path. ### FileLock The filelock library is wrapped in a FileLock effect: https://github.com/anoma/juvix/blob/e6dca22cfdcff936add5e7134f9c6f20416504a5/src/Juvix/Data/Effect/FileLock/Base.hs#L6-L8 There is an [IO interpreter](https://github.com/anoma/juvix/blob/e6dca22cfdcff936add5e7134f9c6f20416504a5/src/Juvix/Data/Effect/FileLock/IO.hs#L8) that uses filelock and an [no-op interpreter](https://github.com/anoma/juvix/blob/e6dca22cfdcff936add5e7134f9c6f20416504a5/src/Juvix/Data/Effect/FileLock/Permissive.hs#L7) that just runs actions unconditionally. ### TaggedLock To make the file locks simpler to use a TaggedLock effect is introduced: https://github.com/anoma/juvix/blob/e6dca22cfdcff936add5e7134f9c6f20416504a5/src/Juvix/Data/Effect/TaggedLock/Base.hs#L5-L11 And convenience function: https://github.com/anoma/juvix/blob/e6dca22cfdcff936add5e7134f9c6f20416504a5/src/Juvix/Data/Effect/TaggedLock.hs#L28 This allows an action to be locked, tagged by a directory that may or may not exist. For example in the following code, an action is performed on a directory `root` that may delete the directory before repopulating the files. So the lockfile cannot be stored in the `root` itself. https://github.com/anoma/juvix/blob/e6dca22cfdcff936add5e7134f9c6f20416504a5/src/Juvix/Extra/Files.hs#L55-L60 ## Pipeline As noted above, we only use locking in the test suite. The main app target pipeline is single threaded and so locking is unnecessary. So the interpretation of locks is parameterised so that locking can be disabled https://github.com/anoma/juvix/blob/e6dca22cfdcff936add5e7134f9c6f20416504a5/src/Juvix/Compiler/Pipeline/Run.hs#L64
2023-11-16 18:19:52 +03:00
- filelock == 0.1.*
- filepath == 1.4.*
- githash == 0.1.*
- hashable == 1.4.*
- language-c == 0.9.*
- libyaml == 0.1.*
Update stackage resolver to LTS 21.6 (#2275) Stack LTS 21.6 uses GHC 9.4.5, binaries for HLS are available via ghcup. Changes required: 1. Fix warnings about type level `:` and `[]` used without backticks. 2. Fix warnings about deprecation of builtin `~` - replaced with `import Data.Type.Equality ( type (~) )` in the Prelude 3. SemVer is no longer a monoid 4. `path-io` now contains the `AnyPath` instances we were defining (thanks to Jan) so they can be removed. 5. Added `aeson-better-errors-0.9.1.1` as an extra-dep. The reason it is not part of the resolver is only because it has a strict bound on base which is not compatible with ghc 9.4.5. To work around this I've set: ``` allow-newer: true allow-newer-deps: - aeson-better-errors ``` which relaxed the upper constraint bounds for `aeson-better-errors` only. When the base constraints have been updated we can remove this workaround. 6. Use stack2cabal to generate the cabal.project file and to freeze dependency versions. https://www.stackage.org/lts-21.6/cabal.config now contains the constraint `haskeline installed`, which means that the version of haskeline that is globally installed with GHC 9.4.5 will be used, see: * https://github.com/commercialhaskell/stackage/issues/7002 GHC 9.4.5 comes with haskeline 0.8.2 preinstalled but our configuration contains the source-repository-package for haskeline 0.8.2.1 (required because we're using a fork) so if you try to run` cabal build` you get a conflict. Constraints from cabal imports cannot yet be overridden so it's not possible to get rid of this conflict using the import method. So we need to use stack2cabal with an explicit freeze file instead. 7. Remove `runTempFilePure` as this is unused and depends on `Polysemy.Fresh` in `polysemy-zoo` which is not available in the resolver. It turns out that it's not possible to use the `Fresh` effect in a pure context anyway, so it was not possible to use `runTempFilePure` for its original purpose. 8. We now use https://github.com/benz0li/ghc-musl as the base container for static linux builds, this means we don't need to maintain our own Docker container for this purpose. 9. The PR for the nightly builds is ready https://github.com/anoma/juvix-nightly-builds/pull/2, it should be merged as soon as this PR is merged. Thanks to @benz0li for maintaining https://github.com/benz0li/ghc-musl and (along with @TravisCardwell) for help with building the static binary. * Closes https://github.com/anoma/juvix/issues/2166
2023-08-11 12:49:33 +03:00
- megaparsec == 9.3.*
- commonmark == 0.2.*
- parsec == 3.1.*
- microlens-platform == 0.4.*
- parser-combinators == 1.3.*
- path == 0.9.*
Update stackage resolver to LTS 21.6 (#2275) Stack LTS 21.6 uses GHC 9.4.5, binaries for HLS are available via ghcup. Changes required: 1. Fix warnings about type level `:` and `[]` used without backticks. 2. Fix warnings about deprecation of builtin `~` - replaced with `import Data.Type.Equality ( type (~) )` in the Prelude 3. SemVer is no longer a monoid 4. `path-io` now contains the `AnyPath` instances we were defining (thanks to Jan) so they can be removed. 5. Added `aeson-better-errors-0.9.1.1` as an extra-dep. The reason it is not part of the resolver is only because it has a strict bound on base which is not compatible with ghc 9.4.5. To work around this I've set: ``` allow-newer: true allow-newer-deps: - aeson-better-errors ``` which relaxed the upper constraint bounds for `aeson-better-errors` only. When the base constraints have been updated we can remove this workaround. 6. Use stack2cabal to generate the cabal.project file and to freeze dependency versions. https://www.stackage.org/lts-21.6/cabal.config now contains the constraint `haskeline installed`, which means that the version of haskeline that is globally installed with GHC 9.4.5 will be used, see: * https://github.com/commercialhaskell/stackage/issues/7002 GHC 9.4.5 comes with haskeline 0.8.2 preinstalled but our configuration contains the source-repository-package for haskeline 0.8.2.1 (required because we're using a fork) so if you try to run` cabal build` you get a conflict. Constraints from cabal imports cannot yet be overridden so it's not possible to get rid of this conflict using the import method. So we need to use stack2cabal with an explicit freeze file instead. 7. Remove `runTempFilePure` as this is unused and depends on `Polysemy.Fresh` in `polysemy-zoo` which is not available in the resolver. It turns out that it's not possible to use the `Fresh` effect in a pure context anyway, so it was not possible to use `runTempFilePure` for its original purpose. 8. We now use https://github.com/benz0li/ghc-musl as the base container for static linux builds, this means we don't need to maintain our own Docker container for this purpose. 9. The PR for the nightly builds is ready https://github.com/anoma/juvix-nightly-builds/pull/2, it should be merged as soon as this PR is merged. Thanks to @benz0li for maintaining https://github.com/benz0li/ghc-musl and (along with @TravisCardwell) for help with building the static binary. * Closes https://github.com/anoma/juvix/issues/2166
2023-08-11 12:49:33 +03:00
- path-io == 1.8.*
- polysemy == 1.9.*
- 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-base == 3.1.*
- singletons-th == 3.1.*
- Stream == 0.4.*
Add package lockfile support (#2388) This PR adds lock file support to the compiler pipeline. The lock file is generated whenever a compiler pipeline command (`juvix {compile, typecheck, repl}`) is run. The lock file contains all the information necessary to reproduce the whole dependency source tree. In particular for git dependencies, branch/tag references are resolved to git hash references. ## Lock file format The lock file is a YAML `juvix.lock.yaml` file written by the compiler alongside the package's `juvix.yaml` file. ``` LOCKFILE_SPEC: { dependencies: { DEPENDENCY_SPEC, dependencies: LOCKFILE_SPEC } DEPENDENCY_SPEC: PATH_SPEC | GIT_SPEC PATH_SPEC: { path: String } GIT_SPEC: { git: {url: String, ref: String, name: String } } ``` ## Example Consider a project containing the following `juvix.yaml`: ```yaml dependencies: - .juvix-build/stdlib/ - git: url: https://github.com/anoma/juvix-containers ref: v0.7.1 name: containers name: example version: 1.0.0 ``` After running `juvix compile` the following lockfile `juvix.lock.yaml` is generated. ```yaml # This file was autogenerated by Juvix version 0.5.1. # Do not edit this file manually. dependencies: - path: .juvix-build/stdlib/ dependencies: [] - git: name: containers ref: 3debbc7f5776924eb9652731b3c1982a2ee0ff24 url: https://github.com/anoma/juvix-containers dependencies: - git: name: stdlib ref: 4facf14d9b2d06b81ce1be1882aa9050f768cb45 url: https://github.com/anoma/juvix-stdlib dependencies: [] - git: name: test ref: a7ac74cac0db92e0b5e349f279d797c3788cdfdd url: https://github.com/anoma/juvix-test dependencies: - git: name: stdlib ref: 4facf14d9b2d06b81ce1be1882aa9050f768cb45 url: https://github.com/anoma/juvix-stdlib dependencies: [] ``` For subsequent runs of the juvix compile pipeline, the lock file dependency information is used. ## Behaviour when package file and lock file are out of sync If a dependency is specified in `juvix.yaml` that is not present in the lock file, an error is raised. Continuing the example above, say we add an additional dependency: ``` dependencies: - .juvix-build/stdlib/ - git: url: https://github.com/anoma/juvix-containers ref: v0.7.1 name: containers - git: url: https://github.com/anoma/juvix-test ref: v0.6.1 name: test name: example version: 1.0.0 ``` `juvix compile` will throw an error: ``` /Users/paul/tmp/lockfile/dep/juvix.yaml:1:1: error: The dependency test is declared in the package's juvix.yaml but is not declared in the lockfile: /Users/paul/tmp/lockfile/dep/juvix.lock.json Try removing /Users/paul/tmp/lockfile/dep/juvix.lock.yaml and then run Juvix again. ``` Closes: * https://github.com/anoma/juvix/issues/2334
2023-10-02 18:51:14 +03:00
- string-interpolate == 0.3.*
Update stackage resolver to LTS 21.6 (#2275) Stack LTS 21.6 uses GHC 9.4.5, binaries for HLS are available via ghcup. Changes required: 1. Fix warnings about type level `:` and `[]` used without backticks. 2. Fix warnings about deprecation of builtin `~` - replaced with `import Data.Type.Equality ( type (~) )` in the Prelude 3. SemVer is no longer a monoid 4. `path-io` now contains the `AnyPath` instances we were defining (thanks to Jan) so they can be removed. 5. Added `aeson-better-errors-0.9.1.1` as an extra-dep. The reason it is not part of the resolver is only because it has a strict bound on base which is not compatible with ghc 9.4.5. To work around this I've set: ``` allow-newer: true allow-newer-deps: - aeson-better-errors ``` which relaxed the upper constraint bounds for `aeson-better-errors` only. When the base constraints have been updated we can remove this workaround. 6. Use stack2cabal to generate the cabal.project file and to freeze dependency versions. https://www.stackage.org/lts-21.6/cabal.config now contains the constraint `haskeline installed`, which means that the version of haskeline that is globally installed with GHC 9.4.5 will be used, see: * https://github.com/commercialhaskell/stackage/issues/7002 GHC 9.4.5 comes with haskeline 0.8.2 preinstalled but our configuration contains the source-repository-package for haskeline 0.8.2.1 (required because we're using a fork) so if you try to run` cabal build` you get a conflict. Constraints from cabal imports cannot yet be overridden so it's not possible to get rid of this conflict using the import method. So we need to use stack2cabal with an explicit freeze file instead. 7. Remove `runTempFilePure` as this is unused and depends on `Polysemy.Fresh` in `polysemy-zoo` which is not available in the resolver. It turns out that it's not possible to use the `Fresh` effect in a pure context anyway, so it was not possible to use `runTempFilePure` for its original purpose. 8. We now use https://github.com/benz0li/ghc-musl as the base container for static linux builds, this means we don't need to maintain our own Docker container for this purpose. 9. The PR for the nightly builds is ready https://github.com/anoma/juvix-nightly-builds/pull/2, it should be merged as soon as this PR is merged. Thanks to @benz0li for maintaining https://github.com/benz0li/ghc-musl and (along with @TravisCardwell) for help with building the static binary. * Closes https://github.com/anoma/juvix/issues/2166
2023-08-11 12:49:33 +03:00
- template-haskell == 2.19.*
Add `juvix format` command (#1886) This PR adds `juvix format` that can be used to format either a single Juvix file or all files in a Juvix project. ## Usage ``` $ juvix format --help Usage: juvix format JUVIX_FILE_OR_PROJECT [--check] [--in-place] Format a Juvix file or Juvix project When the command is run with an unformatted file it prints the reformatted source to standard output. When the command is run with a project directory it prints a list of unformatted files in the project. Available options: JUVIX_FILE_OR_PROJECT Path to a .juvix file or to a directory containing a Juvix project. --check Do not print reformatted sources or unformatted file paths to standard output. --in-place Do not print reformatted sources to standard output. Overwrite the target's contents with the formatted version if the formatted version differs from the original content. -h,--help Show this help text ``` ## Location of main implementation The implementation is split into two components: * The src API: `format` and `formatProject` https://github.com/anoma/juvix/blob/73952ba15c90f33919c75426cf62ae7e83fd3225/src/Juvix/Formatter.hs * The CLI interface: https://github.com/anoma/juvix/blob/73952ba15c90f33919c75426cf62ae7e83fd3225/app/Commands/Format.hs ## in-place uses polysemy Resource effect The `--in-place` option makes a backup of the target file and restores it if there's an error during processing to avoid data loss. The implementation of this uses the polysemy [Resource effect](https://hackage.haskell.org/package/polysemy-1.9.0.0/docs/Polysemy-Resource.html). The recommended way to interpret the resource effect is to use `resourceToIOFinal` which makes it necessary to change the effects interpretation in main to use `Final IO`: https://github.com/anoma/juvix/blob/73952ba15c90f33919c75426cf62ae7e83fd3225/app/Main.hs#L15 ## Format input is `FilePath` The format options uses `FilePath` instead of `AppFile f` for the input file/directory used by other commands. This is because we cannot determine if the input string is a file or directory in the CLI parser (we require IO). I discussed some ideas with @janmasrovira on how to improve this in a way that would also solve other issues with CLI input file/parsing but I want to defer this to a separate PR as this one is already quite large. One consequence of Format using `FilePath` as the input option is that the code that changes the working directory to the root of the project containing the CLI input file is changed to work with `FilePath`: https://github.com/anoma/juvix/blob/f715ef6a531f63c40ac3f629dd9cfea7e867507a/app/TopCommand/Options.hs#L33 ## New dependencies This PR adds new dependencies on `temporary` and `polysemy-zoo`. `temporary` is used for `emptySystemTempFile` in the implementation of the TempFile interpreter for IO: https://github.com/anoma/juvix/blob/73952ba15c90f33919c75426cf62ae7e83fd3225/src/Juvix/Data/Effect/Files/IO.hs#L49 `polysemy-zoo` is used for the `Fresh` effect and `absorbMonadThrow` in the implementation of the pure TempFile interpreter: https://github.com/anoma/juvix/blob/73952ba15c90f33919c75426cf62ae7e83fd3225/src/Juvix/Data/Effect/Files/Pure.hs#L91 NB: The pure TempFile interpreter is not used, but it seemed a good idea to include it while it's fresh in my mind. * Closes https://github.com/anoma/juvix/issues/1777 --------- Co-authored-by: Jonathan Cubides <jonathan.cubides@uib.no>
2023-03-29 16:51:04 +03:00
- temporary == 1.3.*
Update stackage resolver to LTS 21.6 (#2275) Stack LTS 21.6 uses GHC 9.4.5, binaries for HLS are available via ghcup. Changes required: 1. Fix warnings about type level `:` and `[]` used without backticks. 2. Fix warnings about deprecation of builtin `~` - replaced with `import Data.Type.Equality ( type (~) )` in the Prelude 3. SemVer is no longer a monoid 4. `path-io` now contains the `AnyPath` instances we were defining (thanks to Jan) so they can be removed. 5. Added `aeson-better-errors-0.9.1.1` as an extra-dep. The reason it is not part of the resolver is only because it has a strict bound on base which is not compatible with ghc 9.4.5. To work around this I've set: ``` allow-newer: true allow-newer-deps: - aeson-better-errors ``` which relaxed the upper constraint bounds for `aeson-better-errors` only. When the base constraints have been updated we can remove this workaround. 6. Use stack2cabal to generate the cabal.project file and to freeze dependency versions. https://www.stackage.org/lts-21.6/cabal.config now contains the constraint `haskeline installed`, which means that the version of haskeline that is globally installed with GHC 9.4.5 will be used, see: * https://github.com/commercialhaskell/stackage/issues/7002 GHC 9.4.5 comes with haskeline 0.8.2 preinstalled but our configuration contains the source-repository-package for haskeline 0.8.2.1 (required because we're using a fork) so if you try to run` cabal build` you get a conflict. Constraints from cabal imports cannot yet be overridden so it's not possible to get rid of this conflict using the import method. So we need to use stack2cabal with an explicit freeze file instead. 7. Remove `runTempFilePure` as this is unused and depends on `Polysemy.Fresh` in `polysemy-zoo` which is not available in the resolver. It turns out that it's not possible to use the `Fresh` effect in a pure context anyway, so it was not possible to use `runTempFilePure` for its original purpose. 8. We now use https://github.com/benz0li/ghc-musl as the base container for static linux builds, this means we don't need to maintain our own Docker container for this purpose. 9. The PR for the nightly builds is ready https://github.com/anoma/juvix-nightly-builds/pull/2, it should be merged as soon as this PR is merged. Thanks to @benz0li for maintaining https://github.com/benz0li/ghc-musl and (along with @TravisCardwell) for help with building the static binary. * Closes https://github.com/anoma/juvix/issues/2166
2023-08-11 12:49:33 +03:00
- text == 2.0.*
- th-utilities == 0.2.*
Update stackage resolver to LTS 21.6 (#2275) Stack LTS 21.6 uses GHC 9.4.5, binaries for HLS are available via ghcup. Changes required: 1. Fix warnings about type level `:` and `[]` used without backticks. 2. Fix warnings about deprecation of builtin `~` - replaced with `import Data.Type.Equality ( type (~) )` in the Prelude 3. SemVer is no longer a monoid 4. `path-io` now contains the `AnyPath` instances we were defining (thanks to Jan) so they can be removed. 5. Added `aeson-better-errors-0.9.1.1` as an extra-dep. The reason it is not part of the resolver is only because it has a strict bound on base which is not compatible with ghc 9.4.5. To work around this I've set: ``` allow-newer: true allow-newer-deps: - aeson-better-errors ``` which relaxed the upper constraint bounds for `aeson-better-errors` only. When the base constraints have been updated we can remove this workaround. 6. Use stack2cabal to generate the cabal.project file and to freeze dependency versions. https://www.stackage.org/lts-21.6/cabal.config now contains the constraint `haskeline installed`, which means that the version of haskeline that is globally installed with GHC 9.4.5 will be used, see: * https://github.com/commercialhaskell/stackage/issues/7002 GHC 9.4.5 comes with haskeline 0.8.2 preinstalled but our configuration contains the source-repository-package for haskeline 0.8.2.1 (required because we're using a fork) so if you try to run` cabal build` you get a conflict. Constraints from cabal imports cannot yet be overridden so it's not possible to get rid of this conflict using the import method. So we need to use stack2cabal with an explicit freeze file instead. 7. Remove `runTempFilePure` as this is unused and depends on `Polysemy.Fresh` in `polysemy-zoo` which is not available in the resolver. It turns out that it's not possible to use the `Fresh` effect in a pure context anyway, so it was not possible to use `runTempFilePure` for its original purpose. 8. We now use https://github.com/benz0li/ghc-musl as the base container for static linux builds, this means we don't need to maintain our own Docker container for this purpose. 9. The PR for the nightly builds is ready https://github.com/anoma/juvix-nightly-builds/pull/2, it should be merged as soon as this PR is merged. Thanks to @benz0li for maintaining https://github.com/benz0li/ghc-musl and (along with @TravisCardwell) for help with building the static binary. * Closes https://github.com/anoma/juvix/issues/2166
2023-08-11 12:49:33 +03:00
- time == 1.12.*
- transformers == 0.5.*
External package dependencies (#2272) This PR adds external git dependency support to the Juvix package format. ## New dependency Git item You can now add a `git` block to the dependencies list: ```yaml name: HelloWorld main: HelloWorld.juvix dependencies: - .juvix-build/stdlib - git: url: https://my.git.repo name: myGitRepo ref: main version: 0.1.0 ``` Git block required fields: * `url`: The URL of the git repository * `ref`: The git reference that should be checked out * `name`: The name for the dependency. This is used to name the directory of the clone, it is required. Perhaps we could come up with a way to automatically name the clone directory. Current ideas are to somehow encode the URL / ref combination or use a UUID. However there's some value in having the clone directory named in a friendly way. NB: * The values of the `name` fields must be unique among the git blocks in the dependencies list. ## Behaviour When dependencies for a package are registered, at the beginning of the compiler pipeline, all remote dependencies are processed: 1. If it doesn't already exist, the remote dependency is cloned to `.juvix-build/deps/$name` 2. `git fetch` is run in the clone 3. `git checkout` at the specified `ref` is run in the clone The clone is then processed by the PathResolver in the same way as path dependencies. NB: * Remote dependencies of transitive dependencies are also processed. * The `git fetch` step is required for the case where the remote is updated. In this case we want the user to be able to update the `ref` field. ## Errors 1. Missing fields in the Git dependency block are YAML parse errors 2. Duplicate `name` values in the dependencies list is an error thrown when the package file is processed 3. The `ref` doesn't exist in the clone or the clone directory is otherwise corrupt. An error with a suggestion to `juvix clean` is given. The package file path is used as the location in the error message. 4. Other `git` command errors (command not found, etc.), a more verbose error is given with the arguments that were passed to the git command. ## Future work 1. Add an offline mode 2. Add a lock file mechanism that resolves branch/tag git refs to commit hashes * closes https://github.com/anoma/juvix/issues/2083 --------- Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2023-09-01 14:37:06 +03:00
- typed-process == 0.2.*
- unicode-show == 0.1.*
- uniplate == 1.6.*
Update stackage resolver to LTS 21.6 (#2275) Stack LTS 21.6 uses GHC 9.4.5, binaries for HLS are available via ghcup. Changes required: 1. Fix warnings about type level `:` and `[]` used without backticks. 2. Fix warnings about deprecation of builtin `~` - replaced with `import Data.Type.Equality ( type (~) )` in the Prelude 3. SemVer is no longer a monoid 4. `path-io` now contains the `AnyPath` instances we were defining (thanks to Jan) so they can be removed. 5. Added `aeson-better-errors-0.9.1.1` as an extra-dep. The reason it is not part of the resolver is only because it has a strict bound on base which is not compatible with ghc 9.4.5. To work around this I've set: ``` allow-newer: true allow-newer-deps: - aeson-better-errors ``` which relaxed the upper constraint bounds for `aeson-better-errors` only. When the base constraints have been updated we can remove this workaround. 6. Use stack2cabal to generate the cabal.project file and to freeze dependency versions. https://www.stackage.org/lts-21.6/cabal.config now contains the constraint `haskeline installed`, which means that the version of haskeline that is globally installed with GHC 9.4.5 will be used, see: * https://github.com/commercialhaskell/stackage/issues/7002 GHC 9.4.5 comes with haskeline 0.8.2 preinstalled but our configuration contains the source-repository-package for haskeline 0.8.2.1 (required because we're using a fork) so if you try to run` cabal build` you get a conflict. Constraints from cabal imports cannot yet be overridden so it's not possible to get rid of this conflict using the import method. So we need to use stack2cabal with an explicit freeze file instead. 7. Remove `runTempFilePure` as this is unused and depends on `Polysemy.Fresh` in `polysemy-zoo` which is not available in the resolver. It turns out that it's not possible to use the `Fresh` effect in a pure context anyway, so it was not possible to use `runTempFilePure` for its original purpose. 8. We now use https://github.com/benz0li/ghc-musl as the base container for static linux builds, this means we don't need to maintain our own Docker container for this purpose. 9. The PR for the nightly builds is ready https://github.com/anoma/juvix-nightly-builds/pull/2, it should be merged as soon as this PR is merged. Thanks to @benz0li for maintaining https://github.com/benz0li/ghc-musl and (along with @TravisCardwell) for help with building the static binary. * Closes https://github.com/anoma/juvix/issues/2166
2023-08-11 12:49:33 +03:00
- unix-compat == 0.7.*
- unordered-containers == 0.2.*
- utf8-string == 1.0.*
- vector == 0.13.*
Update stackage resolver to LTS 21.6 (#2275) Stack LTS 21.6 uses GHC 9.4.5, binaries for HLS are available via ghcup. Changes required: 1. Fix warnings about type level `:` and `[]` used without backticks. 2. Fix warnings about deprecation of builtin `~` - replaced with `import Data.Type.Equality ( type (~) )` in the Prelude 3. SemVer is no longer a monoid 4. `path-io` now contains the `AnyPath` instances we were defining (thanks to Jan) so they can be removed. 5. Added `aeson-better-errors-0.9.1.1` as an extra-dep. The reason it is not part of the resolver is only because it has a strict bound on base which is not compatible with ghc 9.4.5. To work around this I've set: ``` allow-newer: true allow-newer-deps: - aeson-better-errors ``` which relaxed the upper constraint bounds for `aeson-better-errors` only. When the base constraints have been updated we can remove this workaround. 6. Use stack2cabal to generate the cabal.project file and to freeze dependency versions. https://www.stackage.org/lts-21.6/cabal.config now contains the constraint `haskeline installed`, which means that the version of haskeline that is globally installed with GHC 9.4.5 will be used, see: * https://github.com/commercialhaskell/stackage/issues/7002 GHC 9.4.5 comes with haskeline 0.8.2 preinstalled but our configuration contains the source-repository-package for haskeline 0.8.2.1 (required because we're using a fork) so if you try to run` cabal build` you get a conflict. Constraints from cabal imports cannot yet be overridden so it's not possible to get rid of this conflict using the import method. So we need to use stack2cabal with an explicit freeze file instead. 7. Remove `runTempFilePure` as this is unused and depends on `Polysemy.Fresh` in `polysemy-zoo` which is not available in the resolver. It turns out that it's not possible to use the `Fresh` effect in a pure context anyway, so it was not possible to use `runTempFilePure` for its original purpose. 8. We now use https://github.com/benz0li/ghc-musl as the base container for static linux builds, this means we don't need to maintain our own Docker container for this purpose. 9. The PR for the nightly builds is ready https://github.com/anoma/juvix-nightly-builds/pull/2, it should be merged as soon as this PR is merged. Thanks to @benz0li for maintaining https://github.com/benz0li/ghc-musl and (along with @TravisCardwell) for help with building the static binary. * Closes https://github.com/anoma/juvix/issues/2166
2023-08-11 12:49:33 +03:00
- versions == 6.0.*
- with-utf8 == 1.0.*
- xdg-basedir == 0.2.*
- yaml == 0.11.*
2021-12-23 12:57:55 +03:00
# 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
Update stackage resolver to LTS 21.6 (#2275) Stack LTS 21.6 uses GHC 9.4.5, binaries for HLS are available via ghcup. Changes required: 1. Fix warnings about type level `:` and `[]` used without backticks. 2. Fix warnings about deprecation of builtin `~` - replaced with `import Data.Type.Equality ( type (~) )` in the Prelude 3. SemVer is no longer a monoid 4. `path-io` now contains the `AnyPath` instances we were defining (thanks to Jan) so they can be removed. 5. Added `aeson-better-errors-0.9.1.1` as an extra-dep. The reason it is not part of the resolver is only because it has a strict bound on base which is not compatible with ghc 9.4.5. To work around this I've set: ``` allow-newer: true allow-newer-deps: - aeson-better-errors ``` which relaxed the upper constraint bounds for `aeson-better-errors` only. When the base constraints have been updated we can remove this workaround. 6. Use stack2cabal to generate the cabal.project file and to freeze dependency versions. https://www.stackage.org/lts-21.6/cabal.config now contains the constraint `haskeline installed`, which means that the version of haskeline that is globally installed with GHC 9.4.5 will be used, see: * https://github.com/commercialhaskell/stackage/issues/7002 GHC 9.4.5 comes with haskeline 0.8.2 preinstalled but our configuration contains the source-repository-package for haskeline 0.8.2.1 (required because we're using a fork) so if you try to run` cabal build` you get a conflict. Constraints from cabal imports cannot yet be overridden so it's not possible to get rid of this conflict using the import method. So we need to use stack2cabal with an explicit freeze file instead. 7. Remove `runTempFilePure` as this is unused and depends on `Polysemy.Fresh` in `polysemy-zoo` which is not available in the resolver. It turns out that it's not possible to use the `Fresh` effect in a pure context anyway, so it was not possible to use `runTempFilePure` for its original purpose. 8. We now use https://github.com/benz0li/ghc-musl as the base container for static linux builds, this means we don't need to maintain our own Docker container for this purpose. 9. The PR for the nightly builds is ready https://github.com/anoma/juvix-nightly-builds/pull/2, it should be merged as soon as this PR is merged. Thanks to @benz0li for maintaining https://github.com/benz0li/ghc-musl and (along with @TravisCardwell) for help with building the static binary. * Closes https://github.com/anoma/juvix/issues/2166
2023-08-11 12:49:33 +03:00
- criterion == 1.6.*
- statistics == 0.16.*
- shake == 0.19.*
- colour == 2.3.*
- palette == 0.3.*
2023-01-05 19:48:26 +03:00
2021-12-23 12:57:55 +03:00
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
2021-12-23 12:57:55 +03:00
default-extensions:
- ApplicativeDo
- DataKinds
- DerivingStrategies
- GADTs
- GeneralizedNewtypeDeriving
- ImportQualifiedPost
- LambdaCase
- MultiWayIf
- NoFieldSelectors
- NoImplicitPrelude
- OverloadedStrings
- PatternSynonyms
Nockma compile (#2570) This PR is a snapshot of the current work on the JuvixAsm -> Nockma translation. The compilation of Juvix programs to Nockma now works so we decided to raise this PR now to avoid it getting too large. ## Juvix -> Nockma compilation You can compile a frontend Juvix file to Nockma as follows: example.juvix ``` module example; import Stdlib.Prelude open; fib : Nat → Nat → Nat → Nat | zero x1 _ := x1 | (suc n) x1 x2 := fib n x2 (x1 + x2); fibonacci (n : Nat) : Nat := fib n 0 1; sumList (xs : List Nat) : Nat := for (acc := 0) (x in xs) acc + x; main : Nat := fibonacci 9 + sumList [1; 2; 3; 4]; ``` ``` $ juvix compile -t nockma example.juvix ``` This will generate a file `example.nockma` which can be run using the nockma evaluator: ``` $ juvix dev nockma eval example.nockma ``` Alternatively you can compile JuvixAsm to Nockma: ``` $ juvix dev asm compile -t nockma example.jva ``` ## Tests We compile an evaluate the JuvixAsm tests in https://github.com/anoma/juvix/blob/cb3659e08e552ee9ca40860077e39a4070cf3303/test/Nockma/Compile/Asm/Positive.hs We currently skip some because either: 1. They are too slow to run in the current evaluator (due to arithmetic operations using the unjetted nock code from the anoma nock stdlib). 2. They trace data types like lists and booleans which are represented differently by the asm interpreter and the nock interpreter 3. They operate on raw negative numbers, nock only supports raw natural numbers ## Next steps On top of this PR we will work on improving the evaluator so that we can enable the slow compilation tests. --------- Co-authored-by: Paul Cadman <git@paulcadman.dev> Co-authored-by: Lukasz Czajka <lukasz@heliax.dev>
2024-01-17 13:15:38 +03:00
- QuasiQuotes
- RecordWildCards
- TemplateHaskell
- TypeFamilyDependencies
2021-12-23 12:57:55 +03:00
library:
source-dirs: src
2022-03-24 12:14:29 +03:00
verbatim:
default-language: GHC2021
2021-12-23 12:57:55 +03:00
executables:
juvix:
2021-12-23 12:57:55 +03:00
main: Main.hs
2022-01-18 14:25:42 +03:00
source-dirs: app
2021-12-23 12:57:55 +03:00
dependencies:
- juvix
- haskeline == 0.8.*
- http-conduit == 2.3.*
- mtl == 2.2.*
- optparse-applicative == 0.17.*
- repline == 0.4.*
- string-interpolate == 0.3.*
2022-03-24 12:14:29 +03:00
verbatim:
default-language: GHC2021
Update stackage resolver to LTS 21.6 (#2275) Stack LTS 21.6 uses GHC 9.4.5, binaries for HLS are available via ghcup. Changes required: 1. Fix warnings about type level `:` and `[]` used without backticks. 2. Fix warnings about deprecation of builtin `~` - replaced with `import Data.Type.Equality ( type (~) )` in the Prelude 3. SemVer is no longer a monoid 4. `path-io` now contains the `AnyPath` instances we were defining (thanks to Jan) so they can be removed. 5. Added `aeson-better-errors-0.9.1.1` as an extra-dep. The reason it is not part of the resolver is only because it has a strict bound on base which is not compatible with ghc 9.4.5. To work around this I've set: ``` allow-newer: true allow-newer-deps: - aeson-better-errors ``` which relaxed the upper constraint bounds for `aeson-better-errors` only. When the base constraints have been updated we can remove this workaround. 6. Use stack2cabal to generate the cabal.project file and to freeze dependency versions. https://www.stackage.org/lts-21.6/cabal.config now contains the constraint `haskeline installed`, which means that the version of haskeline that is globally installed with GHC 9.4.5 will be used, see: * https://github.com/commercialhaskell/stackage/issues/7002 GHC 9.4.5 comes with haskeline 0.8.2 preinstalled but our configuration contains the source-repository-package for haskeline 0.8.2.1 (required because we're using a fork) so if you try to run` cabal build` you get a conflict. Constraints from cabal imports cannot yet be overridden so it's not possible to get rid of this conflict using the import method. So we need to use stack2cabal with an explicit freeze file instead. 7. Remove `runTempFilePure` as this is unused and depends on `Polysemy.Fresh` in `polysemy-zoo` which is not available in the resolver. It turns out that it's not possible to use the `Fresh` effect in a pure context anyway, so it was not possible to use `runTempFilePure` for its original purpose. 8. We now use https://github.com/benz0li/ghc-musl as the base container for static linux builds, this means we don't need to maintain our own Docker container for this purpose. 9. The PR for the nightly builds is ready https://github.com/anoma/juvix-nightly-builds/pull/2, it should be merged as soon as this PR is merged. Thanks to @benz0li for maintaining https://github.com/benz0li/ghc-musl and (along with @TravisCardwell) for help with building the static binary. * Closes https://github.com/anoma/juvix/issues/2166
2023-08-11 12:49:33 +03:00
when:
- condition: flag(static)
ld-options:
- -static
- -pthread
tests:
juvix-test:
main: Main.hs
source-dirs: test
dependencies:
- juvix
2022-03-24 12:14:29 +03:00
verbatim:
default-language: GHC2021
Run test suite in parallel (#2507) ## Overview This PR makes the compiler pipeline thread-safe so that the test suite can be run in parallel. This is achieved by: * Removing use of `{get, set, with}CurrentDir` functions. * Adding locking around shared file resources like the the global-project and internal build directory. NB: **Locking is disabled for the main compiler target**, as it is single threaded they are not required. ## Run test suite in parallel To run the test suite in parallel you must add `--ta '+RTS -N -RTS'` to your stack test arguments. For example: ``` stack test --fast --ta '+RTS -N -RTS' ``` The `-N` instructs the Haskell runtime to choose the number of threads to use based on how many processors there are on your machine. You can use `-Nn` to see the number of threads to `n`. These flags are already [set in the Makefile](https://github.com/anoma/juvix/blob/e6dca22cfdcff936add5e7134f9c6f20416504a5/Makefile#L26) when you or CI uses `stack test`. ## Locking The Haskell package [filelock](https://hackage.haskell.org/package/filelock) is used for locking. File locks are used instead of MVars because Juvix code does not control when new threads are created, they are created by the test suite. This means that MVars created by Juvix code will have no effect, because they are created independently on each test-suite thread. Additionally the resources we're locking live on the filesystem and so can be conveniently tagged by path. ### FileLock The filelock library is wrapped in a FileLock effect: https://github.com/anoma/juvix/blob/e6dca22cfdcff936add5e7134f9c6f20416504a5/src/Juvix/Data/Effect/FileLock/Base.hs#L6-L8 There is an [IO interpreter](https://github.com/anoma/juvix/blob/e6dca22cfdcff936add5e7134f9c6f20416504a5/src/Juvix/Data/Effect/FileLock/IO.hs#L8) that uses filelock and an [no-op interpreter](https://github.com/anoma/juvix/blob/e6dca22cfdcff936add5e7134f9c6f20416504a5/src/Juvix/Data/Effect/FileLock/Permissive.hs#L7) that just runs actions unconditionally. ### TaggedLock To make the file locks simpler to use a TaggedLock effect is introduced: https://github.com/anoma/juvix/blob/e6dca22cfdcff936add5e7134f9c6f20416504a5/src/Juvix/Data/Effect/TaggedLock/Base.hs#L5-L11 And convenience function: https://github.com/anoma/juvix/blob/e6dca22cfdcff936add5e7134f9c6f20416504a5/src/Juvix/Data/Effect/TaggedLock.hs#L28 This allows an action to be locked, tagged by a directory that may or may not exist. For example in the following code, an action is performed on a directory `root` that may delete the directory before repopulating the files. So the lockfile cannot be stored in the `root` itself. https://github.com/anoma/juvix/blob/e6dca22cfdcff936add5e7134f9c6f20416504a5/src/Juvix/Extra/Files.hs#L55-L60 ## Pipeline As noted above, we only use locking in the test suite. The main app target pipeline is single threaded and so locking is unnecessary. So the interpretation of locks is parameterised so that locking can be disabled https://github.com/anoma/juvix/blob/e6dca22cfdcff936add5e7134f9c6f20416504a5/src/Juvix/Compiler/Pipeline/Run.hs#L64
2023-11-16 18:19:52 +03:00
ghc-options:
- -threaded
2023-01-05 19:48:26 +03:00
benchmarks:
juvix-bench:
main: Main.hs
source-dirs: bench
2023-01-05 19:48:26 +03:00
dependencies:
- juvix
2023-01-05 19:48:26 +03:00
verbatim:
default-language: GHC2021