1
1
mirror of https://github.com/anoma/juvix.git synced 2025-01-06 06:53:33 +03:00
juvix/package.yaml

165 lines
3.4 KiB
YAML
Raw Normal View History

name: juvix
2023-04-18 15:56:48 +03:00
version: 0.3.2
license: GPL-3.0-only
license-file: LICENSE.md
copyright: (c) 2022- Heliax AG.
maintainer: The PLT Team at Heliax AG <hello@heliax.dev>
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
2021-12-23 12:57:55 +03:00
extra-source-files:
- 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
2021-12-23 12:57:55 +03:00
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.*
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
- polysemy-zoo == 0.8.*
- 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.*
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.*
- 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.*
- 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
- criterion == 1.5.*
- 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
- 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
tests:
juvix-test:
main: Main.hs
source-dirs: test
dependencies:
- juvix
2022-03-24 12:14:29 +03:00
verbatim:
default-language: GHC2021
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