Open hasufell opened 2 years ago
The only workaround I found is running cpphs
manually to expand the files during development: https://github.com/haskell/filepath/pull/95
@gbaz found out in #hackage
that another workaround is this:
System/FilePath/Posix.hs
to System.FilePath/Posix.cpphs
and delete CPP pragmacabal haddock
This however, will add some junk to the beginning of the file, such as:
{-# LINE 1 "System/FilePath/Posix.cpphs" #-}
# 0 "System/FilePath/Posix.cpphs"
# 0 "<built-in>"
# 0 "<command-line>"
# 12 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 17 "/usr/include/stdc-predef.h" 3 4
... lots of newlines before the actual code...
This seems to break the link destinations... you'll always end up at the top of the source file.
Forcing cabal to use cpphs
doesn't seem possible: https://github.com/haskell/cabal/issues/4278
This seems to (somewhat) work:
flag cpphs
Description: Use cpphs (fixes haddock source links)
Default: True
Manual: False
library
...
if flag(cpphs)
ghc-options: -pgmPcpphs -optP--cpp
build-tool-depends: cpphs:cpphs
Prominent example is filepath: https://hackage.haskell.org/package/filepath-1.4.2.1/docs/src/System.FilePath.Posix.html#pathSeparator
Also reported here: https://github.com/haskell/filepath/issues/81