Haddock: Document an ad with an alleged 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 FirstClassModule module is supposed to provide a Bar record type, which is a bit like a first class module. The Example module then instantiates the module and uses the RecordWildCards extension to bring the names to the scope and make them exported.

When you run Haddock (version 2.8) on this module, it will interfere with 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 their type signatures in the Example module?

I do not want to write type signatures, because in this case they are templates. If I have to write them, this module loses its meaning.

+6
source share
2 answers

From the Haddock User Guide:

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

Note that Haddock does not contain a system of type Haskell - if you do not write a type signature for a function, then Haddock cannot determine what its type is and it will not be included in the documentation.

Documentation for version 2.8, version 2.9 is the newest.

+1
source

Actually, I just found out that from version 2.9.2 Haddock will call type signatures for exported functions. Unfortunately, I cannot find a way to decorate them with additional documentation.

For example, a module

 module Test (foo) where foo = "bar" 

will create a type signature

 foo :: String 

in the documentation, but it seems like I cannot add text to it.

0
source

Source: https://habr.com/ru/post/885555/


All Articles