cabalism / hpack-dhall Goto Github PK
View Code? Open in Web Editor NEWUse hpack's phrasing in dhall to write cabal files
License: BSD 3-Clause "New" or "Revised" License
Use hpack's phrasing in dhall to write cabal files
License: BSD 3-Clause "New" or "Revised" License
For the stack golden test, the description generated has extra newlines compared to the expected output;
Expected stack.yaml.golden
file;
description: ! 'Please see the README.md for usage information, and
the wiki on Github for more details. Also, note that
the API for the library is not currently stable, and may
change significantly, even between minor releases. It is
currently only intended for use by the executable.'
Generated stack.yaml
file;
description: ! 'Please see the README.md for usage information, and
the wiki on Github for more details. Also, note that
the API for the library is not currently stable, and may
change significantly, even between minor releases. It is
currently only intended for use by the executable.'
The golden tests are brittle on the version of hpack:
test-suite-golden/test-files/key/import-relative/package.yaml.cabal
--- This file has been generated from package.yaml by hpack version 0.34.2.
+-- This file has been generated from package.yaml by hpack version 0.34.4.
The field ordering in the rendered YAML is all over the place;
> dhall-hpack-yaml
source-dirs: library
library:
...
tests:
...
copyright: ...
category: ...
license-file: ...
maintainer: ...
ghc-options: ...
dependencies:
...
name: hpack-dhall
version: 0.4.0
extra-source-files:
...
synopsis: hpack's dhalling
github: blockscope/hpack-dhall
tested-with: GHC == 8.4.3, GHC == 8.4.4, GHC == 8.6.1
license: BSD3
executables:
...
description: ...
The travis hpack build is failing;
$ cabal configure --enable-tests --ghc-options=-Werror && cabal build && cabal test
...
[1 of 2] Compiling Hpack.Dhall ( src/Hpack/Dhall.hs, dist/.../Dhall.o )
src/Hpack/Dhall.hs:23:25: error:
• Couldn't match type ‘Data.Text.Internal.Text’
with ‘Data.Text.Internal.Lazy.Text’
NB: ‘Data.Text.Internal.Lazy.Text’
is defined in ‘Data.Text.Internal.Lazy’
‘Data.Text.Internal.Text’ is defined in ‘Data.Text.Internal’
Expected type: Data.Text.Internal.Text
-> ExceptT
String IO (Dhall.Core.Expr Dhall.Parser.Src Dhall.Core.Path)
Actual type: Data.Text.Internal.Lazy.Text
-> ExceptT
String IO (Dhall.Core.Expr Dhall.Parser.Src Dhall.Core.Path)
• In the second argument of ‘(>>=)’, namely ‘parseExpr’
In the first argument of ‘(>>=)’, namely ‘readInput >>= parseExpr’
In a stmt of a 'do' block:
expr <- readInput >>= parseExpr >>= liftIO . Dhall.Import.load
src/Hpack/Dhall.hs:28:56: error:
• Couldn't match type ‘[Char]’
with ‘trifecta-1.7.1.1:Text.Trifecta.Delta.Delta’
Expected type: trifecta-1.7.1.1:Text.Trifecta.Delta.Delta
Actual type: FilePath
• In the first argument of ‘Dhall.Parser.exprFromText’, namely
‘file’
In the second argument of ‘(.)’, namely
‘Dhall.Parser.exprFromText file’
In the expression: liftResult . Dhall.Parser.exprFromText file
The license is not being recognised by github as BSD-3-Clause. For an example that works, see the license of the units-parser.
when hpack imports package.dhall it should do in such a way that any import in package.dhall is referenced relative to the package.dhall directory and not relative to the directory where hpack is run
SOURCE: nmattia/snack#61 (comment)
Since libyaml 0.1.1.0, there's a test failure when generating a stack.yaml:
[...]
.dhall to yaml
stack: FAIL (0.01s)
Files 'test/golden/test-files/real-world/stack/stack.yaml.golden' and 'test/golden/test-files/real-world/stack/stack.yaml' differ
[...]
❯ diff stack.yaml.golden stack.yaml
4c4
< description: ! 'Please see the README.md for usage information, and
---
> description: 'Please see the README.md for usage information, and
34c34
< - ! '-optP-Wno-nonportable-include-path # workaround [Filename case on macOS · Issue
---
> - '-optP-Wno-nonportable-include-path # workaround [Filename case on macOS · Issue
319c319
< - condition: ! '!(flag(disable-git-info))'
---
> - condition: '!(flag(disable-git-info))'
349c349
< condition: ! '!flag(integration-tests)'
---
> condition: '!flag(integration-tests)'
The specific change happened here: snoyberg/yaml#165
Currently dhall-hpack-cabal
shows hpack
help. Please retain the ability to pass options to hpack but show these in the help with the options of dhall-hpack-cabal
.
Usage: dhall-hpack-cabal [ --silent ] [ --force | -f ] [ PATH ] [ - ]
dhall-hpack-cabal --version
dhall-hpack-cabal --help
> __bin/dhall-hpack-cabal --version
hpack version 0.31.0
> __bin/dhall-hpack-cabal --numeric-version
0.31.0
> __bin/dhall-hpack-cabal package.dhall
hpack-dhall.cabal is up-to-date
> __bin/dhall-hpack-cabal package.dhall --silent
> __bin/dhall-hpack-cabal package.dhall --force
generated hpack-dhall.cabal
Move versioned stack-*.yaml
files to a folder for such stack files.
I'm dealing with a situation where the dhall is coming from nowhere in particular, but the cabal file needs to be put in a particular directory. Does hpack even allow this? I know it can output to stdout.
With stack-8.6.1.yaml;
resolver: nightly-2018-10-15
packages:
- '.'
extra-deps:
- dhall-1.18.0
- cborg-0.2.1.0
- dhall-json-1.2.4
- hpack-0.31.0
- megaparsec-7.0.1
- repline-0.2.0.0
- serialise-0.2.1.0
- infer-license-0.2.0
hpack-dhall> stack build --stack-yaml=stack-8.6.1.yaml
...
[1 of 3] Compiling Hpack.Dhall ( src/Hpack/Dhall.hs, .stack-work/.../Dhall.o )
/Users/pdejoux/dev/src/haskell/hpack-dhall/src/Hpack/Dhall.hs:34:69: error:
• Couldn't match type ‘Value’ with ‘([String], Value)’
Expected type: FilePath -> IO (Either String ([String], Value))
Actual type: FilePath -> IO (Either String Value)
• In the first argument of ‘Hpack.setDecode’, namely ‘decodeDhall’
In the second argument of ‘Hpack.hpack’, namely
‘(Hpack.setDecode decodeDhall options)’
In the expression:
Hpack.hpack verbose (Hpack.setDecode decodeDhall options)
|
34 | Just (verbose, options) -> Hpack.hpack verbose (Hpack.setDecode decodeDhall options)
| ^^^^^^^^^^^
Completed 54 action(s).
There's no LICENSE file in this repo but there is one for hpack. @sol could you please add a license to hpack-dhall
and let me know if you would let me use decodeDhall
for NixOS/cabal2nix#374?
Please add hpack-dhall to stackage.
Do continuous integration with github actions.
The current readme says "There is no documentation". Please add some documentation.
Please add some real world examples to the golden tests such as hpack and stack.
We have one executable that writes the .cabal
file. Please add other executables that show what the intermediate steps are, that shows the json
, yaml
and dhall
.
With the build I'm seeing warnings for:
-Wunused-imports
-Wdeprecations
In #21 the field ordering was set for rendering YAML. Please do the same for rendering JSON.
Spurred on by the pull request #33 to add a prelude.
We use the hpack dialect but for cabal there's already a prelude with dhall-to-cabal.
cc @locallycompact.
There's a build failure (deps) on hackage for ghc-8.0.2
for hpack-dhall-0.5.2
:
When checking before adding hpack-dhall
to stackage nightly, I found it failed one of the golden tests when following the procedure for adding a package:
# Build from the tarball on Hackage to check for missing files
$ stack unpack yourpackage && cd yourpackage-*
# Generate a pristine stack.yaml, adding any missing extra-deps
$ rm -f stack.yaml && stack init --resolver nightly --solver
# Build, generate docs, test, and build benchmarks
$ stack build --resolver nightly --haddock --test --bench --no-run-benchmarks
Generating stack.yaml
with stack init
was failing with:
$ rm -f stack.yaml && stack init --resolver nightly --solver
Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- ./
- test/golden/test-files/key/
- test/golden/test-files/key/empty-inferred/
- test/golden/test-files/key/import-local/
- test/golden/test-files/key/import-relative/
- test/golden/test-files/real-world/hpack/
- test/golden/test-files/real-world/stack/
Multiple .cabal files found in directory /.../hpack-dhall-0.5.0/test/golden/test-files/key/
: empty-package.cabal
, when-dependencies.yaml.cabal
, empty-package.yaml.cabal
, when-dependencies.cabal
I added --ignore-subdirs
to filter out the *.cabal
files of the golden tests.
-- $ rm -f stack.yaml && stack init --resolver nightly --solver
++ $ rm -f stack.yaml && stack init --resolver nightly --solver --ignore-subdirs
> ls -R **/*.cabal
test/golden/test-files/key/empty-inferred/empty-inferred.cabal
test/golden/test-files/key/empty-inferred/package.yaml.cabal
test/golden/test-files/key/empty-package.cabal
test/golden/test-files/key/empty-package.yaml.cabal
test/golden/test-files/key/import-local/import-local.cabal
test/golden/test-files/key/import-local/package.yaml.cabal
test/golden/test-files/key/import-relative/import-relative.cabal
test/golden/test-files/key/import-relative/package.yaml.cabal
test/golden/test-files/key/when-dependencies.cabal
test/golden/test-files/key/when-dependencies.yaml.cabal
test/golden/test-files/real-world/hpack/hpack.cabal
test/golden/test-files/real-world/hpack/hpack.yaml.cabal
test/golden/test-files/real-world/stack/stack.cabal
test/golden/test-files/real-world/stack/stack.yaml.cabal
The test that failed is .dhall to dhall/stack
:
.dhall to dhall
hpack: OK
stack: FAIL (0.01s)
The stack.yaml
initialised from hpack-dhall.cabal
is:
resolver: nightly-2018-11-27
packages:
- .
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.