This repository was archived by the owner on Aug 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 237
This repository was archived by the owner on Aug 3, 2024. It is now read-only.
hyperlinked-source handles promoted data constructors (DataKinds) incorrectly #593
Copy link
Copy link
Closed
Description
As an example, consider the following source file, which lifts some data constructors to the type level using the leading-tick syntax:
{-# LANGUAGE DataKinds #-}
module DataKind where
data Foo = Foo1 | Foo2
type Bar = 'Foo1
type Baz = 'Foo2
If I run haddock --hyperlinked-source -h DataKind.hs
, and view the highlighted source using a "source" link, then everything from 'Foo1
onward is typeset as one big character literal.
Besides the incorrect highlighting, another problem is broken links. The HTML version of the source has no HTML anchor defined for #Baz
, so the source link for type Baz
is broken.
Here is the actual HTML version of the source file. Note that everything from 'Foo1
to the end is in one hs-char
span.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE DataKinds #-}</span><span>
</span><a name="line-2"></a><span>
</span><a name="line-3"></a><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">DataKind</span><span> </span><span class="hs-keyword">where</span><span>
</span><a name="line-4"></a><span>
</span><a name="line-5"></a><span class="hs-keyword">data</span><span> </span><a name="Foo"><a href="DataKind.html#Foo"><span class="hs-identifier">Foo</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a name="Foo1"><a href="DataKind.html#Foo1"><span class="hs-identifier">Foo1</span></a></a><span> </span><span class="hs-glyph">|</span><span> </span><a name="Foo2"><a href="DataKind.html#Foo2"><span class="hs-identifier">Foo2</span></a></a><span>
</span><a name="line-6"></a><span>
</span><a name="line-7"></a><span class="hs-keyword">type</span><span> </span><a name="Bar"><a href="DataKind.html#Bar"><span class="hs-identifier">Bar</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-char">'Foo1
type Baz = 'Foo2
</span></pre></body></html>
Metadata
Metadata
Assignees
Labels
No labels