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

Allow passing RTS options to GHC in stack.yaml #5568

Merged
merged 4 commits into from
Jun 29, 2021

Conversation

parsonsmatt
Copy link
Contributor

@parsonsmatt parsonsmatt commented Jun 23, 2021

Note: Documentation fixes for https://docs.haskellstack.org/en/stable/ should target the "stable" branch, not master.

Please include the following checklist in your PR:

  • Any changes that could be relevant to users have been recorded in the ChangeLog.md
  • The documentation has been updated, if necessary.

I added an integration test that ensures stack builds successfully when passing RTS options to GHC.

Fixes #5180

@parsonsmatt parsonsmatt marked this pull request as ready for review June 23, 2021 15:22
@parsonsmatt parsonsmatt requested review from borsboom and snoyberg and removed request for borsboom June 24, 2021 17:52
@parsonsmatt
Copy link
Contributor Author

it seems like the integration tests on Mac are broken for an unrelated reason - failing to execute GHC for permissions?

(other, rest) =
takeRtsArgs xs
in
(T.unpack x ++ " " ++ other, rest)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure how important this is in this case, but this has quadratic performance. I'd recommend instead collecting a list of Texts and then combining with T.unwords. In fact, I think then you'd be able to use break (== "-RTS")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the tip! I've provided a much nicer looking implementation, and it even made me aware of the case where a user does not provide a -RTS in the argument list.

I decided to splice a -RTS on the end of the collected RTS args regardless. This matches the syntax you might use in a CLI invocation - ghc --version +RTS -N -A128m. As far as I know, this shouldn't cause any problems - any string without an -RTS would completely fail without this, and any string with non-RTS arguments after a +RTS would fail in either case.

stack.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

@snoyberg snoyberg left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@snoyberg snoyberg merged commit 83b607c into commercialhaskell:master Jun 29, 2021
@parsonsmatt parsonsmatt deleted the matt/ghc-rts-options branch June 29, 2021 13:09
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.

Passing RTS options to GHC via ghc-options in stack.yaml fails
2 participants