Closed carlosdagos closed 3 years ago
Thank you so much.
Let me have a look at that. That's really great!
nix-build -A ormolu-fix
should actually be a nix-shell
, because it uses a shellHook
to run ormolu in the local directory instead of running it on the source moved to /nix/store
;) I should make that more obvious in the documentation or even in nix itself.
I've added a small review. I really don't have a lot to say, that's already in pretty good shape.
However I'm really embarrassed by the next step. The point of removing haskell-src-ext
and haskell-src-meta
is to:
ghc-lib
. Do you think it is possible to instead depend on the ghc
lib packaged with ghc?haskell-src-ext
and you are now using the ghc parser, this is awesome!haskell-src-meta
. As you said, this may be better in its own (released and tested) library. Or replaced by tree that grows, or even by something in the ghc lib that I'm not aware of. I'm sure something to convert Haskell code to TH exists, that's basically what the normal splice are doing, I'm still surprised that it is not exposed in the ghc API.So are the benefit of your work outweighting the downside?
I will add: Thank you so much for adding such a thorough dev environment with Nix, and comprehensive tests. It makes contributing so much nicer.
Thank you about that. To be honest, I'm ashamed of the quality of PyF
code (have you seen the well named function fofo
? ;), so my only hope to get something workable was to add tests and tooling.
I'm adding that using the ghc
lib is, from my point of view, perfectly fine here. The code which we will parse is part of the current codebase, so I think it is safe to assume that a code compiler with GHC 8.6 won't have GHC 8.10 expression in its PyF expression.
@carlosdagos do you plan on pushing this further?
@luke-clifton I may have been a bit rough with @carlosdagos and I apologize for that.
There are still open questions, mostly:
ghc
module or the ghc-lib
one?@guibou so sorry that I never got back to this! You weren’t rough at all, your review was thorough and I appreciate that. Apologies for the radio silence, some private matters took up my time.
I think a “meta” package would be nice in general, but might take a bit longer. I know that the haskell-src-exts package is deprecated but I don’t know the “urgency” around not using it anymore.
Closed in favor of #61 which is exactly the same pull request, but at the time of opening the PR, I did not realized that it will be a new one instead of continuing on this one.
In short, I'd like to merge it like that (with the minor changes I did in #61), we'll see later how to improve (and release) Meta.hs
.
Draft PR as to explore an alternative to #49. Would also perhaps help solve #9, #8, and maybe #16.
Draft because it's really hacked together :smile:
Things to note:
pyf_810
, seemingly the API changes in a breaking way. I tried adding a bunch of CPP stuff in there, but I didn't want to make the code worse than it is already.PackageImports
so thatghc-lib-parser
can live next totemplate-haskell
. As stated in the https://github.com/digital-asset/ghc-lib/#readme,ghc-lib
does not have a TemplateHaskell runtime, so what this does (inMeta.hs
) is turn TH extension variants to the ones found inghc-lib
(among other things).Meta.hs
file has a lot of code which is basically a replacement forhaskell-src-meta
. That kind of stuff might warrant a library all on its own. You'll notice a lot of commented code there, because I only came up with enough to make the tests pass.nix-build -A ormolu-fix
didn't seem to do much, I don't know if all the stuff in this changeset is supported by ormolu, so unfortunately the code does not match the desired formatting.I will add: Thank you so much for adding such a thorough dev environment with Nix, and comprehensive tests. It makes contributing so much nicer.
Carlos