[Haskell-cafe] Examples

Henning Thielemann lemming at henning-thielemann.de
Sat Aug 8 12:23:59 EDT 2009


On Sat, 8 Aug 2009, Andrew Coppin wrote:

> As some of you may remember, I recently released a couple of packages on 
> Hackage. I'd like to also release some example programs using these packages, 
> but I'm not sure of the best way to do this.
>
> Do I make the example programs part of the package itself? Do I release a 
> seperate package which just contains the example code? Something else 
> entirely? What's the recommendation here?

Usually I include the example program in the package, but make its 
compilation conditional using a Cabal flag like buildExamples. This way, 
you can build the examples explicitly by
   cabal install package -fbuildExamples
  but they won't be build when the package is build as dependent package.

See for instance:
   http://code.haskell.org/gnuplot/gnuplot.cabal


More information about the Haskell-Cafe mailing list