[Haskell-beginners] cabal: library and executable

Brent Yorgey byorgey at seas.upenn.edu
Fri May 10 04:57:18 CEST 2013


On Thu, May 09, 2013 at 06:10:55PM +0200, Ertugrul Söylemez wrote:
> 
> If the program is just a demo that you wouldn't normally want to install
> with the library, you can make it a test suite instead of an executable:

This seems like a strange hack to me.  If it's not a test suite you
shouldn't call it one. Instead you can use a flag which the user has
to manually specify if they want the demo executables.  Something like

  flag demo
    description: Install the demos.
    default: False
    manual: True

  executable theDemo
    ...
    if !flag(demo)
      buildable: False
    if flag(demo)
      build-depends: base, mylib, ...

For a real-world example of this, see http://hackage.haskell.org/package/diagrams%2Dbuilder .

-Brent



More information about the Beginners mailing list