-
Notifications
You must be signed in to change notification settings - Fork 103
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
Automatic generation of hpack from .cabal files? #63
Comments
Yes, this is definitely something we thought about before. I would prefer this to be in the same project, mainly because I want the (edit: typo) |
Yes, this is a frequently requested feature and would be an awesome addition to @soenkehahn Would you imagine that calling |
Hmm, switching behaviors based on context like that seems unpredictable, I think I'd prefer a special command or flag. I don't see this as really being that difficult. The main bits that could use some fanciness is the error messages for cases that hpack can't handle, and extracting out the common duplication among sections. |
I started working on this. Need to clean-up the yaml generation bit a lot and I think I broke something, but from hpack.cabal it's generating: |
Adds modules `Hpack.Convert` and `Hpack.Convert.Run` for reading a `GenericPackageDescription` onto a `Package` and running the user-facing conversion routine. The user-facing option is exposed through: ``` $ hpack --convert [cabal-file|project-dir] ``` - - - Also adds tests testing we can read cabal files generated from some of the README examples and hpack's into package.yamls that look like the original ones. Everything should be supported, including converting conditionals. I really need feedback on how to make `Hpack.Config` `Package` related `ToJSON` instances cleaner. That's the ugly bit of the code. There some cases where we run into problems in conversion. For example, the Cabal library does not expose in its data-structures if `buildable` was specified or not. To keep the output clean, I initially striped it from sections if it was true, but then empty conditional blocks could be generated. Right now it'll only output `buildable` if it's not redundant based on context. It'll also remove any empty conditional branches. This closes sol#63.
Good work @yamadapc !! |
Adds modules `Hpack.Convert` and `Hpack.Convert.Run` for reading a `GenericPackageDescription` onto a `Package` and running the user-facing conversion routine. The user-facing option is exposed through: ``` $ hpack --convert [cabal-file|project-dir] ``` - - - Also adds tests testing we can read cabal files generated from some of the README examples and hpack's into package.yamls that look like the original ones. Everything should be supported, including converting conditionals. I really need feedback on how to make `Hpack.Config` `Package` related `ToJSON` instances cleaner. That's the ugly bit of the code. There some cases where we run into problems in conversion. For example, the Cabal library does not expose in its data-structures if `buildable` was specified or not. To keep the output clean, I initially striped it from sections if it was true, but then empty conditional blocks could be generated. Right now it'll only output `buildable` if it's not redundant based on context. It'll also remove any empty conditional branches. This closes sol#63.
Hpack looks really nice, great work! I think a good step towards adoption would be to support automatic conversion of cabal files to hpack format. This could be done in a new package,
hpack-convert
, or something, to avoid a dependency on Cabal in the main hpack library (maybe that dependency would be ok, though?).The text was updated successfully, but these errors were encountered: