-
Notifications
You must be signed in to change notification settings - Fork 199
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
Depend on Hlint as a library #620
Comments
My current mental model is the first one. I believe HLint already looks at several places for the data files, and there is a flag --datadir which let's you specify where to find data files. There are also places in the API that let you specify where files are. I'm not such a fan of anything TH related as my experience is TH makes things deeply unpleasant - failures on users systems, slow compile, version changes etc. Does that work for you? |
We can make it work, it is a bit complicated though, since we have to distribute the data-files somehow. To patch hlint, I wouldn't have thought about using TH, but rather replacing the data-files needed at run-time with default values in hlint library. |
The data values are quite large, so that would be a little unpleasant. |
Maybe I got something wrong: When you use data-files and use cabal to find them at run-time, the data-file location is compiled into the executable, e.g. |
@fendor - somewhat. You can:
|
Wasn't aware of the first option, that can be very helpful, thank you! |
The behaviour when HLint can't find its files is unspecified. If you want a particular behaviour I can change it, but my guess is it's not super useful regardless of what it does. For HIE don't you typically compile it on a users computer? If so, isn't HLint not a problem? Or are you trying to change that? |
We are trying to change that since the compile-times are quite long. Thus, we want to be able to distribute binaries, see #1068. |
Makes sense. I don't have a good way to solve this. If HLint had a command to copy its data files to some location, could you use that when compiling to generate a redistributable package that worked nicely? |
I am not sure. |
I meant during HIE building you build HLint in as a library. Run |
Yes, this would work, but I think this is already possible, right? With more template haskell, though. |
I think HLint uses the first hlint.yaml it finds, and doesn't worry about the others, so that should be fine. |
@ndmitchell I will try to add |
Note there is no --gather-deps at the moment. There could be though (PR welcome). Or maybe you'd just want a mode that prints out the data dir and exits, letting you do a recursive copy. |
This option seems a bit unnecessary. You can get the data-files directly by unpacking the release tarball. ( |
I will propably solve this using |
Thanks, let me know if it doesn't work nicely. |
@ndmitchell would you reconsider the TH approach? It's not just nicer for using Here's a commit using |
This problem is discussed in HIE #1143.
If you depend on hlint as a library, it demands that the location of its data-files are known at compile-time.
This is fine, if you are using binary packages of hlint or build it with cabal/stack from source.
However, if you depend on hlint as a library, and want to distribute a static executable of your application, hlint will usually fail, because the location of its data-files is known at compile-time and baked into the application. Thus, it might happen that the data-files are not present on the installation system at the expected location.
To solve this problem, the following approaches can be chosen:
What is your view on this issue? Which way would you suggest, and is there another, possibly better, way to address this issue?
The text was updated successfully, but these errors were encountered: