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 |
There was a problem hiding this comment.
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.
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.
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 initwill 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.