[Haskell-cafe] stack, git, directory structure
Magnus Therning
magnus at therning.org
Mon Jun 26 08:40:11 UTC 2017
Dennis Raddle <dennis.raddle at gmail.com> writes:
> I got a private reply which helps but it made me think of another question.
>
> In the stack demo, there's one executable 'helloworld-exe' which is
> compiled from app/Main.hs.
>
> If I'm going to have several executables, what do I call the source files,
> and how do I control the file name of the executable that gets built?
AFAIU that's what the `executable: <name>` in your .cabal does. This is
the text describing executable sections at [1].
Executable sections (if present) describe executable programs
contained in the package and must have an argument after the section
label, which defines the name of the executable. This is a freeform
argument but may not contain spaces.
And you control the source files using `main-is:` and `other-modules:`.
One common pattern I've seen is to put most source files into a library
and then have each executable use that library and have a very "thin"
main source file.
/M
[1]: https://www.haskell.org/cabal/users-guide/developing-packages.html#executables
--
Magnus Therning OpenPGP: 0x927912051716CE39
email: magnus at therning.org jabber: magnus at therning.org
twitter: magthe http://therning.org/magnus
The greatest performance improvement of all is when a system goes from
not-working to working.
— John Ousterhout
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170626/f32d459b/attachment.sig>
More information about the Haskell-Cafe
mailing list