Skip to content

:doc command reproduces docstrings literally.

It's cool, but IMHO this introduces way too much variation.

Given Ex.hs like

module Ex where

-- | Foo type
data Foo =
  -- | Foo constructor
  FooC

{- | Bar type -}
data Bar 
  = BarC
    {- ^ Bar constructor -}

we have

% ghci-9.6.2 -haddock Ex.hs
GHCi, version 9.6.2: https://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/phadej/.ghci
[1 of 1] Compiling Ex               ( Ex.hs, interpreted )
Ok, one module loaded.
*Ex> :doc Foo
Foo :: * 	-- Type constructor defined at Ex.hs:4:1
-- | Foo type
*Ex> :doc FooC
FooC :: Foo 	-- Data constructor defined at Ex.hs:6:3
-- | Foo constructor
*Ex> :doc Bar
Bar :: * 	-- Type constructor defined at Ex.hs:9:1
{-| Bar type -}
*Ex> :doc BarC
BarC :: Bar 	-- Data constructor defined at Ex.hs:10:5
{-^ Bar constructor -}

Also in {- ... -} comments the initial space is actually eaten. So it's not even 100% as written.

If changing the default is not a real option, I'd like a flag (-fsomething) to print docs always as -- ... or {- ... -} comments.

I don't care about author preference, I want machine to "format" docs for me.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information