[Haskell-cafe] can this be done with stack?

Michael Snoyman michael at snoyman.com
Fri Jun 2 11:01:26 UTC 2017

If you run `stack ghc -- ...`, everything after the -- will be passed to
the ghc command. For determining settings, please see this section of the
user guide:


On Fri, Jun 2, 2017 at 12:31 PM, Dennis Raddle <dennis.raddle at gmail.com>

> Something I'm not clear on, with regard to 'stack ghc', is how to tell
> stack what environment, modules, etc. to use -- when I run it on a file
> that is not within my stack directory tree. I tried simple running 'stack
> ghc filename.hs' and it couldn't find any of my libraries. I also cannot
> figure out how to pass arguments to ghc.
> D
> On Thu, Jun 1, 2017 at 11:27 PM, Michael Snoyman <michael at snoyman.com>
> wrote:
>> Have you tried `stack ghc filename.hs`? Also, you could try the script
>> interpreter approach, with something like this:
>> #!/usr/bin/env stack
>> -- stack --resolver lts-8.12 script --compile
>> main = putStrLn "Hello World"
>> Running `stack filename.hs` will compile and run your file, and you can
>> reuse the resulting executable.
>> On Fri, Jun 2, 2017 at 9:03 AM, Dennis Raddle <dennis.raddle at gmail.com>
>> wrote:
>>> Using stack, but I have a need to build lots of executables. **lots**
>>> and new ones all the time .. my application is music playback. I used to
>>> have a single executable for playing music, and used it for all
>>> compositions. I later found that I needed to do a lot of configuration
>>> specific to each composition, and that the most natural language for
>>> specifying all the data and functions specific to a composition was
>>> Haskell. That means I have a source file for every composition, in the same
>>> directory where I store that composition (as a Sibelius file). But a couple
>>> things. (1) they aren't in the stack tree, (2) I don't want to add every
>>> one of these to a cabal file.
>>> What is the best way to approach this goal?
>>> D
>>> _______________________________________________
>>> Haskell-Cafe mailing list
>>> To (un)subscribe, modify options or view archives go to:
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170602/23ce47ad/attachment.html>

More information about the Haskell-Cafe mailing list