Skip to content
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

An option for package-dhall inputs. #51

Open
philderbeast opened this issue Aug 25, 2018 · 3 comments
Open

An option for package-dhall inputs. #51

philderbeast opened this issue Aug 25, 2018 · 3 comments

Comments

@philderbeast
Copy link
Contributor

I've stopped using package.yaml in favour of package.dhall in flare-timing, making good use of hpack-dhall from @sol. Could we please have an option of supplying snack with a package in dhall format?

> snack --help
- Usage: snack (--snack-nix PATH | --package-yaml PATH) COMMAND
+ Usage: snack (--snack-nix PATH | --package-yaml PATH | --package-dhall PATH) COMMAND
philderbeast added a commit to cabalism/snack that referenced this issue Oct 11, 2018
Also use dhall format --inplace on the existing *.dhall files.
@philderbeast
Copy link
Contributor Author

philderbeast commented Oct 12, 2018

I want to try writing a DhallToJson.hs module similar to the existing YamlToJson.hs module.

import qualified Data.Yaml as Yaml

This module will need to make some Dhall.* imports.

import qualified Dhall.Parser
import qualified Dhall.Import
import qualified Dhall.TypeCheck
import qualified Dhall.JSON

@nmattia how do I add packages that are missing so that those imports resolve?

@philderbeast
Copy link
Contributor Author

philderbeast commented Nov 6, 2018

I'm now maintainer of hpack-dhall. The executable dhall-hpack-json in that package might be just what we need instead of using dhall-to-json. It resolves imports and pretty prints JSON equivalent to running yaml2json on a package.yaml.

"dhall-to-json <<< ${writeText "d2j" text} > $out"

@nmattia
Copy link
Owner

nmattia commented Nov 7, 2018

@philderbeast I missed your comment above (#51 (comment)). You can add them like this:

[ (haskellPackages.ghcWithPackages (ps: [ ps.aeson ps.yaml ])) glibcLocales ];

It resolves imports and pretty prints JSON equivalent to running yaml2json on a package.yaml.

I see two solutions:

  1. We use the import resolution to then cherry-pick the imported files and feed them to nix
  2. We simply handle the dhall parsing/evaluation on the Haskell side and only feed the generated JSON to nix

philderbeast added a commit to cabalism/snack that referenced this issue Nov 9, 2018
philderbeast added a commit to cabalism/snack that referenced this issue Nov 9, 2018
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

2 participants