-
Notifications
You must be signed in to change notification settings - Fork 697
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
Add with-compiler field for cabal scripts #6310
Conversation
Adds a new data type and field grammar for parsing script metadata. Now it is possible to have scripts like: #!/usr/bin/env cabal {- cabal: build-depends: base with-compiler: ghc-8.6.5 -} main = putStrLn "hey" Progresses towards haskell#5698
9a8c402
to
6e5f07c
Compare
<$> blurFieldGrammar L.executable (executableFieldGrammar "script") | ||
<*> optionalFieldAla "with-compiler" FilePathNT L.hcPath | ||
{-# SPECIALIZE scriptFieldGrammar :: ParsecFieldGrammar' Script #-} | ||
{-# SPECIALIZE scriptFieldGrammar :: PrettyFieldGrammar' Script #-} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no EOL newline. Not biggie, but if you can configure your editor for this project, it would be nice next time!
At this point, we should really start "versioning" the "script spec format" and make use of the version field right after the
|
I’d use `cabal-version: 3.2` everywhere. We have machinery for that, also finding static`cabal:` marker is easier.
Motivation: less ad-hoc syntax/grammar, even it’s slightly more verbose
… On 10 Nov 2019, at 10.34, Herbert Valerio Riedel ***@***.***> wrote:
At this point, we should really start "versioning" the "script spec format" and make use of the version field right after the cabal: marker, e.g.
{- cabal: 3.2
build-depends: base ^>= { 4.12.0, 4.13.0 }
with-compiler: ghc-8.6.5
-}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
/cc @typedrat |
I would also like to be able to specify the compiler to use on the command line. For example
It seems the option is currently just ignored? |
@mpickering It's not ignored; you're invoking the special shebang interface; If you had used the normal designated CLI invocation for cabal scripts via Consider this simple script:
Then, compare the outputs of the three invocations:
Does it make sense now? (NB: Only the one with |
Thanks. I did not know you could use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I think @hvr raised the valid concern of need to versioning. I'll assign this to myself and merge after 3.0.1.0 and 3.2.0.0 dust is settled and add |
@phadej is this something you still intended to get to? |
is this superceded by #7997 ? |
With #7997 you can specify |
In that case, let me close. @bubba: thank you for the PR and apologies that it dragged on for so long. If you think there's anything in the PR that can get rebased, scavenged and put to good use, please kindly open a new PR and we'll do our best not to lose it again. |
Adds a new data type and field grammar for parsing script metadata.
Now it is possible to have scripts like:
Progresses towards #5698
Please include the following checklist in your PR:
[ci skip]
is used to avoid triggering the build bots.Please also shortly describe how you tested your change. Bonus points for added tests!