-
Notifications
You must be signed in to change notification settings - Fork 696
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
Make cabal init
create Main.hs if it doesn't exist.
#2483
Make cabal init
create Main.hs if it doesn't exist.
#2483
Conversation
`cabal init` will create Main.hs if the following conditions hold: - creating an executable (not a library) - the mainIs flag has been specified - the file the mainIs flag is pointing to doesn't exist
/cc @byorgey |
[ "module Main where" | ||
, "" | ||
, "main :: IO ()" | ||
, "main = putStrLn \"Hello, World!\"" |
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.
This is our chance for some branding! What funny/witty/clever thing can we have the default Main.hs
print out besides "Hello, World!"? (note: I am just debating the color of the bikeshed, this should not be taken too seriously). "Hello, Cabal!"? "Hello, Haskell!"? "Launching missiles..."? ...?
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.
This sounds great! I'd appreciate some bikeshedding on what it should say. (I don't particularly have any good ideas on what it should say!)
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.
I think "Hello, Haskell!" would be a non-controversial choice =)
I tried this out but it doesn't seem to work. If I run |
@byorgey, I think you're saying that the I was under the assumption that libraries would not have a Should I remove this check and also create a |
@cdepillabout , no, that is not what I was saying. I agree libraries should not have a |
@byorgey, I understand what you're saying. But that's really strange. When I run
Basically, I create an empty directory, run I'm wondering what's going on when you're running cabal and why it's not going through the same code paths? Looking at my pull request, here are three possible problems I could think of:
I'm not sure what else could be the reason that it's working on my system and not on yours. Do you have any idea of things I could take a look at? |
I changed the |
Hmm, I'm not sure. I will try to take another careful look at it soon. It could also be that I was just doing something wrong. |
Okay, thanks. I really appreciate it. |
+1
|
Just got around to testing this again, and it works great. Sorry, I don't know what I was doing wrong before! |
Make `cabal init` create Main.hs if it doesn't exist.
cabal init
will create Main.hs if the following conditions hold:This implements issue #2304.
Now, after doing
cabal init
, you can immediately docabal install
,cabal run
, etc.