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

Accept arbitrary entry points for executables #16

Merged
merged 1 commit into from
Jul 15, 2015
Merged

Conversation

sol
Copy link
Owner

@sol sol commented May 14, 2015

No description provided.

x : xs -> isIdentifier x && isModule xs
_ -> False

isIdentifier :: String -> Bool
Copy link

Choose a reason for hiding this comment

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

Isn't this more properly a isVariableIdentifier? Constructor identifiers can have uppercase

Copy link
Owner Author

Choose a reason for hiding this comment

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

Good point. I'll also reject reserved keywords.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Hmm, but the it would become isQualifiedVariableIdentifier. I think I will ignore the ambiguity in naming for now until we actual have a name clash.

@sol sol force-pushed the arbitrary-entry-points branch 2 times, most recently from de830d7 to 20f1e97 Compare May 15, 2015 04:13
isQualifiedIdentifier ["Foo", "Bar", "baz"] `shouldBe` True

it "rejects invalid input" $ do
isQualifiedIdentifier ["Foo", "Bar", "Baz"] `shouldBe` False
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe add a test for ["Foo", "bar", "Baz"]?

@soenkehahn
Copy link
Collaborator

This seems neat, but I wonder: what's the primary motivation for supporting something like Run.run?

I also wonder which ghc versions support this.

@jkarni
Copy link

jkarni commented May 15, 2015

Some relevant discussion here.

This seems neat, but I wonder: what's the primary motivation for supporting something like Run.run?

I kind of like the idea of being allowed to have two or more different executables from only one source file.

@soenkehahn
Copy link
Collaborator

This would also remove the necessity for having dummy Main.hs files, right?

@soenkehahn
Copy link
Collaborator

LGTM.

@soenkehahn
Copy link
Collaborator

Yeah, I want this. :)

@sol
Copy link
Owner Author

sol commented May 19, 2015

Yes, me too. But there is still a concern, according to the GHC manual -main-is is a compile time option. As I understand it, objects files compiled with -main-is can not be reused for other purposes and object files compiled without it can not be used as main entry point (but I still have to try). This is ok if you already have a double compilation setup, but e.g having a library section and then depend on that in an executable section and specify one module from the library as main probably won't work :(

Sent from my iPhone

On 19 May 2015, at 6:29 pm, Sönke Hahn notifications@github.com wrote:

Yeah, I want this. :)


Reply to this email directly or view it on GitHub.

@soenkehahn
Copy link
Collaborator

You mean it will just break? As in cabal will through link errors?

@sol
Copy link
Owner Author

sol commented May 22, 2015

@soenkehahn cabal will complain about a missing source file. Haven't tried plain ghc.

@sol
Copy link
Owner Author

sol commented May 22, 2015

I still think it's possible to get this working by generating a Main.hs instead of relying on GHCs -main-is.

But I'm not sure if I want to do this right now. This would be a super useful feature, but we would diverge from "simple generating cabal files" at that point.

@sol sol merged commit 5ea133a into master Jul 15, 2015
@sol sol deleted the arbitrary-entry-points branch July 15, 2015 01:24
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.

3 participants