Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haddock: Document a declaration with inferred type signature?

Consider the following module

{-# LANGUAGE RecordWildCards #-}
module Example (foo, fuh, fon, fuzz) where

import qualified FirstClassModule (Bar(foo,fuh,fon,fuzz), makeBar)

FirstClassModule.Bar {..} = FirstClassModule.makeBar parameter

parameter :: Int
parameter = 15

The intention is that the the module FirstClassModule provides a record type Bar which works a bit like a first class module. Then, the module Example instantiates the module and uses the RecordWildCards extension to bring the names into scope and make them exportable.

When you run Haddock (version 2.8) on this module, it will interfere the type signatures for the foo functions and include them in the API documentation. Now, my question is:

Is there a way to document the resulting names foo, fuh, etc. without writing down their type signatures in the Example module?

I don't want to write the type signatures because in this case because they are boilerplate. If I have to write them down, this module loses its raison d'être.

like image 838
Heinrich Apfelmus Avatar asked Apr 09 '11 09:04

Heinrich Apfelmus


1 Answers

From the Haddock user manual:

http://www.haskell.org/haddock/doc/html/markup.html#id564988

Note that Haddock doesn't contain a Haskell type system — if you don't write the type signature for a function, then Haddock can't tell what its type is and it won't be included in the documentation.

The documentation is for version 2.8, version 2.9 is the newest.

like image 187
Antoine Latter Avatar answered Oct 19 '22 22:10

Antoine Latter