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

Copying code from ghc-mod rather than depending on it is _very_ fragile #12

Open
DanielG opened this issue Apr 27, 2015 · 9 comments
Open

Comments

@DanielG
Copy link

DanielG commented Apr 27, 2015

There must be a better way to support your use case than to outright duplicate the code. Maybe we can work together to add whatever you need to the exported API? I'm ghc-mod's maintainer so I might be able to help ;)

@imeckler
Copy link
Owner

Great! The code duplicated from ghc-mod is only used to set ghc flags according to the project's cabal file. I don't remember exactly, but I think the main reason I had to duplicate it was to fix the issue in ghc-mod where the new binary cabal format wasn't supported. It seems like this has been fixed as of the last few weeks, so I think I'll be able to remove the duplicated code.

I'll make a comment here when I know for certain what (if anything) I would need to be exposed in ghc-mod.

@DanielG
Copy link
Author

DanielG commented Apr 28, 2015 via email

@imeckler
Copy link
Owner

That's odd because when I tried mote I still got the error that was symptomatic of the Cabal-1.22 trouble.

Did you install cabalparse? This was my workaround hack to address the 1.22 problem.

@DanielG
Copy link
Author

DanielG commented Apr 28, 2015

Ah right, that's probably it.

@imeckler
Copy link
Owner

imeckler commented May 3, 2015

Which version of ghc-mod should I depend on? Is it on hackage?

@DanielG
Copy link
Author

DanielG commented May 3, 2015

Well you'll have to build against the development version until I release it if you need ghc 7.10 and cabal>1.22 support. Otherwise the one from hackage is fine. Though if you need any API additions then you'll have to build against a development version anyways.

I guess the best way to solve this would be to add a flag to mote's cabal file, something like ghc-mod-devl, set that to default to true and in that flag depend on ghc-mod == 0 (which is the version of ghc-mod from master). Cabal will then and then try to find the development version (you can make it available using cabal sandbox add-source) and fall back to that flag being false if it can't find it. In which case you would depend on ghc-mod >= 5.2 or whatever.

You can then use your existing module doing the ghc-mod stuff with ghc-mod-5.2.x.x and use the new stuff with the devel version by setting CPP defines when the flag is set/unset or by using some hs-source-dirs sorcery.

@DanielG
Copy link
Author

DanielG commented May 3, 2015

BTW did you not get the E-Mail I sent you a few days ago?

@imeckler
Copy link
Owner

imeckler commented May 3, 2015

I did not. It's in this image. http://parametricity.com/images/back.jpg

@DanielG
Copy link
Author

DanielG commented May 3, 2015

Yeah, that's where I sent it before. I sent you another one. According to my mail sever it was delivered. Maybe check spam or something?

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