Support -- | with leading function arrows
Describe the option you'd like to add
haddock-style-parts
Option that controls the formatting of haddock comments attached to parts of a declaration.
This is currently controlled by the function-arrows option. I would like to format haddock comments attached to parts of a declaration differently from function-arrows.
Values: null, leading, trailing
The null setting would keep the current behavior.
Show a code example exemplifying the different option settings
Example with function-arrows: leading and haddock-style-parts: trailing:
foo
-- | An integer
:: Int
-- | A character
-> Char
-- | The result
-> Bool
Example with function-arrows: trailing and haddock-style-parts: leading:
foo ::
Int ->
-- ^ An integer
Char ->
-- ^ A character
Bool
-- ^ The result
Partly inspired by this comment: https://github.com/fourmolu/fourmolu/issues/266#issuecomment-1766608579
I reallise this option should probably also account for the haddock-style when documenting record fields. In that case haddock-style-parts should have the exact same meaning as for parts of a type declaration. When set to null fourmolu should revert back to the default behaviour based on comma-style.
I don't think your proposed function syntax will work. If you run haddock on that code, does it generate the correct docs?
Never mind, apparently GHC 9.0 supports this.
I'm in favor of adding a haddock-placement option that defaults to leading when function-arrows is trailing and vice-versa!