[Haskell-cafe] Examples
Andrew Coppin
andrewcoppin at btinternet.com
Wed Aug 12 14:24:00 EDT 2009
John D. Ramsdell wrote:
>> Usually I include the example program in the package, but make its compilation conditional using a Cabal flag like buildExamples.
>>
>
> But then the binaries generated from the example program get
> installed. I think the poster wants to share the source code, not
> install a demo.
>
Indeed yes. Example programs that don't really "do" anything exciting,
but show you what kind of program structure you need to use and which
functions to read up on to get your bearings.
Since nobody else seems to have mentioned it yet: Another possibility is
to embed [short!] examples into the Haddock documentation. For example,
Control.Monad.Reader has several pages of example code at the bottom of
the Haddock page. I am ambivilent as to whether this is a good or bad
idea...
> I haven't figure out a way to specify test programs that don't get
> installed, but are only intended to be built and run within the
> context of a source distribution.
>
Yes, I was going to ask about that too - but that's a seperate question. ;-)
More information about the Haskell-Cafe
mailing list