Ticket #79 (closed defect: fixed)

Opened 6 years ago

Last modified 12 months ago

Source links don't work for things defined using Template Haskell

Reported by: SamB Owned by:
Priority: major Milestone:
Version: Keywords: TH
Cc: SamB, pho@…


The reason for this is that HsColour? can't insert anchors for TH declarations. Perhaps TH defs could be linked by line number somehow? (This would obviously need to be coordinated with HsColour?.)

Change History

Changed 6 years ago by SamB

  • cc SamB added

Changed 6 years ago by SamB

  • keywords TH added

Changed 3 years ago by PHO

  • cc pho@… added

Changed 2 years ago by anonymous

  • milestone 2.5.0 deleted

Milestone 2.5.0 deleted

Changed 12 months ago by haasn

I was not able to find a way to figure out though the GHC API whether something comes from a template haskell slice or not, but I did realize that this can be fixed rather straightforwardly by just using #line-%{LINE} instead of %{NAME} for all source links. HsColour? happily outputs anchors for them.

I've patched Haddock to allow you to override the source URLs (making the last occurrence take effect instead of the first) eg. in --haddock-options.

A possible resolution for this issue could be to change Cabal's default behavior to use #line-%{LINE} links instead of #%{NAME}, but I'm not 100% confident that this will never break. Are line locations *always* available for names that would otherwise have valid source links?

Changed 12 months ago by Fūzetsu

  • status changed from new to closed
  • resolution set to fixed

Changed 12 months ago by Fūzetsu

This is fixed as far as Haddock side is concerned. Cabal's behaviour has to be discussed with Cabal, perhaps we should open an issue with then.

Changed 12 months ago by haasn

Note that Haddock now differentiates between TH spliced definitions and regular definitions, you can use the new flag --source-entity-line to give a URL format that will be used for linking to individual lines.

I will contact Cabal about it.

Note: See TracTickets for help on using tickets.