[Haskell-cafe] Re: Using Haddock to document ADTs

Simon Marlow simonmarhaskell at gmail.com
Tue Oct 23 07:39:35 EDT 2007


Alfonso Acosta wrote:

> I'm beginning to get familiar with Haddock and I want to document a
> library which, as usually happens, has some ADT definitions.
> 
> I'd like to document the ADTs both for the end-user (who shouldn't be
> told about its internal implementation) and future developers.

Haddock is designed to document APIs for the end-user rather than the 
developer, although it has been suggested several times that it could 
generate source-code documentation too.

One way to do what you want is to split the module into two:

module Lib.ADT.Internals (ADT(..)) where
data ADT = C1 | ... | Cn

module Lib.ADT (ADT) where
import Lib.ADT.Internals

developers can import the .Internals module, and end-users import the ADT 
module.

Cheers,
	Simon



More information about the Haskell-Cafe mailing list