haddock icon indicating copy to clipboard operation
haddock copied to clipboard

Issue with escaping single quote character

Open Boarders opened this issue 3 years ago • 1 comments

In my file I have the following:

import qualified Data.List as List (foldl', foldl1')

-- | A total variant of `List.foldl1\'`
foldl1' :: (a -> a -> a) -> NonEmpty a -> a
foldl1' f (x:|xs) =  List.foldl' f x xs

This doesn't correct link in the displayed haddock comment. Am I doing something wrong?

Boarders avatar Nov 19 '21 23:11 Boarders

Maybe haddock trips over its own too liberal linking syntax: https://haskell-haddock.readthedocs.io/en/latest/markup.html#hyperlinked-identifiers

Referring to a Haskell identifier, whether it be a type, class, constructor, or function, is done by surrounding it with a combination of single quotes and backticks. For example:

-- | This module defines the type 'T'.

`T` is also ok. 'T` and `T' are accepted but less common.

The latter two variants should better be rejected...

Maybe related:

  • https://github.com/haskell/haddock/issues/1593

andreasabel avatar May 19 '23 16:05 andreasabel