No, it's not possible. Functions can have per-argument and per-type-param documentation, and it would make documentation inconsistent if you could:
- write different versions in different locations
- have one version override another
- introduce inconsistencies in argument documentation: what if you override the main doc string for a function; should the argument doc strings be removed?
The following file:
module Bla
( -- * Fooishness
-- | This is 'foo'. It is not 'bar'.
foo
, -- * Barishness
-- | This is 'bar'. It is sometimes a little 'foo'.
bar
) where
-- | The actual foo documentation
foo :: a -- ^ The a
-> b -- ^ The b
-> c
foo = undefined
-- | The actual bar documentation
bar :: a
bar = undefined
...yields this documentation:
As you can see, you can use section comments to kind of emulate function documentation strings, but the documentation will only be properly generated if you use function documentation comments right by the type signatures.
Foo
which exports typesA
,B
andC
(with documentation) and moduleBar
which re-exports onlyA
, then the doc files forBar
will automatically contain the relevant documentation forA
, copied over from moduleFoo
. – Chris Taylor