I am currently working on a project in which I am setting up a cabal file to create several executable files that share a library created by the same file. The cabal project is built like this , with one section library, followed by several sections executablethat include this library in their sections build-depends.
I use this approach, so I can make general functions available for any number of executable files and create more executable files if necessary.
However, in his Monad Reader article on Hoogle p.33 , Neil Mitchell advocates combining Haskell projects into a single executable file with several modes (for example, using the Neil Mitchell CmdArgs library.) Thus, there can be one mode for launching web server, another database query mode from the command line, etc. Quote:
Provide one executable
In version 3, there were four executable programs - one for generating ranking information, one for searching on the command line, one for web search searching, and one for conducting regression testing. Version 4 has one executable file that performs all of the above and more, is controlled by flags. There are many advantages to providing only one final program - this reduces the likelihood of code breaking without noticing it, it makes the overall file size smaller, without duplicating the Haskell runtime system, it reduces the number of commands that users need to learn. Switching to a single multi-purpose executable seems to be a common topic, which tools like darcs and hpc, based on the same command with multiple modes.
? , ?