Skip to content

Dhall --format removes equal sign for "in", but dhall-to-json throw invalid input error #1754

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jeli8-cor opened this issue Apr 19, 2020 · 7 comments

Comments

@jeli8-cor
Copy link

When running dhall format on the following script:

let a = "something"
let b = "somethingElse"

in { a = a,
      b = b
     }

in the new version (1.31.1), we'll get:

let a = "something"
let b = "somethingElse"

in { a
    , b
     }

But, when we'll run dhall-to-json on that file, we'll get the following error:

Error: Invalid input

package.dhall:32:5:
   |
32 |     , cluster-role
   |     ^
unexpected ','
expecting = or whitespace

If I'll return the equal sign in the script and run dhall-to-json (without formatting it first), it will work...
Issue is detected only in new version - 1.31.1 , 1.6.3 (dhall and dhall-to-json, respectively)

@Gabriella439
Copy link
Collaborator

@jeli8-cor: I believe the issue here is that your dhall-to-json executable was built against dhall-1.31.0, which has the bug you described (see: #1732)

If you built dhall-to-json yourself (e.g. using cabal or stack) I can help you fix your build. If you downloaded a prebuilt executable that has this problem then let me know so that I can make sure that the upstream source of the executable is fixed.

@ari-becker
Copy link

(context: @jeli8-cor is a colleague on my team and I'm trying to help pin this down)

@Gabriel439 I noticed that the release for 1.31.0 has dhall-json's version set to 1.6.3, but that the release for 1.31.1 also set dhall-json's version to 1.6.3, which makes it seem like dhall-json wasn't updated with the 1.31.1 release when it fact it was.

as @jeli8-cor is an OS X user, I noticed that this resulted in homebrew formulae being updated for dhall and dhall-json on different dates:
https://github.com/Homebrew/homebrew-core/blob/master/Formula/dhall-json.rb (20 days ago)
https://github.com/Homebrew/homebrew-core/blob/master/Formula/dhall.rb (11 days ago)

Maybe, even if the contents behind https://hackage.haskell.org/package/dhall-json-1.6.3/dhall-json-1.6.3.tar.gz changed, homebrew didn't trigger a new build and it's causing homebrew users to get the wrong binary?

@Gabriella439
Copy link
Collaborator

@ari-becker: That is correct. The dhall-json-1.6.3 build on the 1.31.1 release page was rebuilt against dhall-1.31.1. This is because dhall's Haskell API did not change so it didn't require publishing a new version of dhall-json. After publishing the dhall-1.31.1 release I also blacklisted the 1.31.0 version on Hackage so that Cabal would not select that version by default going forward.

My rough understanding of how the Homebrew model works is that Haskell packages are not rebuilt if their Haskell dependencies change, so I'm guessing the rough chain of events was:

  • dhall-1.31.0 / dhall-json-1.6.3 were released to Hackage and both were built and cached by Brew
  • dhall-1.31.1 was released to Hackage, so Homebrew only rebuilt dhall, but not dhall-json

The reason why Homebrew does things this way is because Homebrew packages Haskell packages differently from, say, Nix. The Homebrew package for dhall-json does not depend on the Homebrew package for dhall. They are each built independently by downloading all of their dependencies straight from Hackage (instead of using Brew to manage their Haskell dependencies).

@jeli8-cor
Copy link
Author

@Gabriel439 , I tried to download the version directly and not via homebrew and everything works as expected. So it must be the homebrew issue and we need to solve it from there

@Gabriella439
Copy link
Collaborator

@jeli8-cor: I just opened a threat on the Brew Discourse to ask about this:

https://discourse.brew.sh/t/rebuild-reverse-dependencies-of-a-changed-haskell-package/7516

@Gabriella439
Copy link
Collaborator

I have a pull request up against homebrew-core to fix this: Homebrew/homebrew-core#53553

@Gabriella439
Copy link
Collaborator

Fixed by Homebrew/homebrew-core#53553

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants