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

Embed data files #824

Merged
merged 4 commits into from
Jan 17, 2020
Merged

Embed data files #824

merged 4 commits into from
Jan 17, 2020

Conversation

Avi-D-coder
Copy link
Contributor

closes:#699

Embeds data files so the hlint executable is self contained.
This allows for easy packaging with stack and cabal.
And enables hlint to be used as a library without shipping data files.

From #620 (comment)

ndmitchell would you reconsider the TH approach?

It's not just nicer for using hlint as a library it's nicer when using the executable too. I'm on a 256G laptop and I delete ~/.stack when ever it gets past 10G. I install hlint using stack install, so when I delete ~/.stack hlint has to be rebuilt, just to get 3 data files.

Here's a commit using file-embed. The TH is relegated to one file. The executable actually gets slightly smaller 48117184 to 48020968 (GHC 8.8).

@Avi-D-coder
Copy link
Contributor Author

TemplateHaskell is confined to src/EmbedData.hs. If it causes a problem on a particular platform, an alternative module could be conditionally compiled with the old readFile $ cmdDataDir </> "default.yaml" method.

Copy link
Owner

@ndmitchell ndmitchell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Given what you've said, and the obvious benefits, it does seem like this is the right way to go to simplify everything. Let's address the remarks in the PR and then I'll merge.

src/CmdLine.hs Show resolved Hide resolved
src/Config/Read.hs Outdated Show resolved Hide resolved
hlint.cabal Show resolved Hide resolved
@ndmitchell ndmitchell merged commit c91d05f into ndmitchell:master Jan 17, 2020
@ndmitchell
Copy link
Owner

That's way nicer. Thanks a lot!

@Avi-D-coder
Copy link
Contributor Author

@ndmitchell Could you push a release to hackage so hie can use this?

@ndmitchell
Copy link
Owner

Sorry @Avi-D-coder - I've been on holiday. Should have this done by this evening.

@Avi-D-coder
Copy link
Contributor Author

Great thanks

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

Successfully merging this pull request may close these issues.

2 participants