Git Product home page Git Product logo

hpack-dhall's Introduction

cabalism

hpack-dhall's People

Contributors

aeons avatar philderbeast avatar sol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hpack-dhall's Issues

Generated description has extra newlines in YAML.

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.'

Golden tests are brittle on the version of hpack

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.

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: ...

Couldn't match type *.Text with *.Lazy.Text.

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

Test incompatibility with libyaml 0.1.1.0

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

Show relevant hpack options and forward these on.

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 

Couldn't match type ‘Value’ with ‘([String], Value)’ with ghc-8.6.1.

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).

Show intermediate json, yaml and dhall.

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 stackage nightly ghc-8.6.2 test ".dhall to dhall/stack" failed.

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:
- .

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.