Discussion:
[Haskell-cafe] Haddock infix constructors in markup
(too old to reply)
Ozgur Akgun
2010-04-26 16:15:24 UTC
Permalink
Hi all,

If I have the following data type:

data Expr = Num Int | Expr :+: Expr | Expr :-: Expr

Haddock handles the infix constructors, and generates a very nice output
(html in this case)
However when I try to reference to one of the infix constructors in the
markup of other functions it fails to hyperlink.

-- | If the input is 'Num' does magic, if it is ':+:' does even more magic!
someFunc :: Expr -> Expr

In the output of this markup, the 'Num' is hyperlinked but the ':+:' is not.
Is there a different syntax for infix constructors (and for infix functions
presumably) or does haddock simple lack this feature?

Best,
--
Ozgur Akgun
Daniel Fischer
2010-04-26 16:40:11 UTC
Permalink
Post by Ozgur Akgun
Hi all,
data Expr = Num Int | Expr :+: Expr | Expr :-: Expr
Haddock handles the infix constructors, and generates a very nice output
(html in this case)
However when I try to reference to one of the infix constructors in the
markup of other functions it fails to hyperlink.
-- | If the input is 'Num' does magic, if it is ':+:' does even more
magic! someFunc :: Expr -> Expr
In the output of this markup, the 'Num' is hyperlinked but the ':+:' is
not. Is there a different syntax for infix constructors (and for infix
functions presumably) or does haddock simple lack this feature?
Infix functions work fine (try referring to e.g. '&&' in the haddock
comment), but infix constructors apparently not.
Post by Ozgur Akgun
Best,
David Waern
2010-04-26 18:47:48 UTC
Permalink
Post by Daniel Fischer
Post by Ozgur Akgun
Hi all,
data Expr = Num Int | Expr :+: Expr | Expr :-: Expr
Haddock handles the infix constructors, and generates a very nice output
(html in this case)
However when I try to reference to one of the infix constructors in the
markup of other functions it fails to hyperlink.
-- | If the input is 'Num' does magic, if it is ':+:' does even more
magic! someFunc :: Expr -> Expr
In the output of this markup, the 'Num' is hyperlinked but the ':+:' is
not. Is there a different syntax for infix constructors (and for infix
functions presumably) or does haddock simple lack this feature?
Infix functions work fine (try referring to e.g. '&&' in the haddock
comment), but infix constructors apparently not.
Yes, I actually fixed this a few weeks ago in Haddock's lexer. Colon
was just not included in the character set for identifiers.

David
Ozgur Akgun
2010-04-26 20:06:16 UTC
Permalink
So, how can we make use of this fix?
Post by David Waern
Post by Daniel Fischer
Post by Ozgur Akgun
Hi all,
data Expr = Num Int | Expr :+: Expr | Expr :-: Expr
Haddock handles the infix constructors, and generates a very nice output
(html in this case)
However when I try to reference to one of the infix constructors in the
markup of other functions it fails to hyperlink.
-- | If the input is 'Num' does magic, if it is ':+:' does even more
magic! someFunc :: Expr -> Expr
In the output of this markup, the 'Num' is hyperlinked but the ':+:' is
not. Is there a different syntax for infix constructors (and for infix
functions presumably) or does haddock simple lack this feature?
Infix functions work fine (try referring to e.g. '&&' in the haddock
comment), but infix constructors apparently not.
Yes, I actually fixed this a few weeks ago in Haddock's lexer. Colon
was just not included in the character set for identifiers.
David
_______________________________________________
Haskell-Cafe mailing list
http://www.haskell.org/mailman/listinfo/haskell-cafe
--
Ozgur Akgun
Daniel Fischer
2010-04-26 20:42:09 UTC
Permalink
Post by Ozgur Akgun
So, how can we make use of this fix?
$ cabal install haddock-2.7.2
No, it's not yet in there :(
David Waern
2010-04-27 11:40:23 UTC
Permalink
Post by Daniel Fischer
Post by Ozgur Akgun
So, how can we make use of this fix?
$ cabal install haddock-2.7.2
No, it's not yet in there :(
Yes, I should make a new release. In the meantime, you could try

darcs get http://code.haskell.org/haddock

David

Daniel Fischer
2010-04-26 20:19:24 UTC
Permalink
Post by Ozgur Akgun
So, how can we make use of this fix?
My guess:

$ cabal install haddock-2.7.2
Ivan Miljenovic
2010-04-26 23:53:13 UTC
Permalink
Post by Ozgur Akgun
data Expr = Num Int | Expr :+: Expr | Expr :-: Expr
[snip]
-- | If the input is 'Num' does magic, if it is ':+:' does even more magic!
someFunc :: Expr -> Expr
In the output of this markup, the 'Num' is hyperlinked but the ':+:' is not.
I would hazard a guess that the Num hyperlink points to the Num
typeclass in the Prelude rather than your Num constructor. As for
your infix constructor, I have no idea.
--
Ivan Lazar Miljenovic
***@gmail.com
IvanMiljenovic.wordpress.com
Ozgur Akgun
2010-04-27 09:17:52 UTC
Permalink
I shouldn't have choosen Num for the constructor name, it led to confusions
apparently.
You can replace tha Num with anything you want, doesn't change the
situation.
I mean, it's not the problematic part.

Is there any news about the fix in the lexer? When can we use it?
Post by Ozgur Akgun
Post by Ozgur Akgun
data Expr = Num Int | Expr :+: Expr | Expr :-: Expr
[snip]
-- | If the input is 'Num' does magic, if it is ':+:' does even more
magic!
Post by Ozgur Akgun
someFunc :: Expr -> Expr
In the output of this markup, the 'Num' is hyperlinked but the ':+:' is
not.
I would hazard a guess that the Num hyperlink points to the Num
typeclass in the Prelude rather than your Num constructor. As for
your infix constructor, I have no idea.
--
Ivan Lazar Miljenovic
IvanMiljenovic.wordpress.com
--
Ozgur Akgun
Loading...