sorry for this really uninformed question but I'm trying out vs code right now and want to configure a task that's compiling the file I am working on. My folder structure and the configured task look like this:

The problem is, that this doesn't compile my app.hs source file but instead gives me the following ghc error: ghc: unrecognised flag: -o app app.hs. I have tested the command ghc -o app app.hs directly from the command prompt and it works just fine. So I think the error has something to do with the way vs code sends what I have written in tasks.json to the command prompt. I can't figure out what to do though. Does anybody have an idea?
Thanks to @duplode and with a little playing around I now came up with the following task-setup (see picture below):

For answering my question only the first out of the three tasks I defined is of relevance. As you can see the trick was to change "args: ["-o app app.hs"]" to "args: ["-o", "app", "app.hs"]". Please note however that -o app is not relevant and can be omitted in this case. The -o-flag is for renaming the ghc output files. If you omit this flag ghc will name all of the output files according to the input filename. So in my case the input file app.hs leads to the output files app.exe, app.o and app.hi. Only if you want to name your output files different from your input file does it make sense to use the -o-flag.
As for the other two tasks I defined: If someone will ever read this and be interested in it, just comment or send me a message.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With