filepath icon indicating copy to clipboard operation
filepath copied to clipboard

Haddock "source" links are broken since the `OsPath` transition

Open sol opened this issue 1 year ago • 6 comments

Before: https://hackage.haskell.org/package/filepath-1.4.2.2/docs/src/System.FilePath.Posix.html#takeFileName

After: https://hackage.haskell.org/package/filepath-1.4.100.3/docs/src/System.FilePath.Posix.html#takeFileName

@hasufell I think I understand the underlying motivation, and I am generally sympathetic to DRYing things up, this is why so far I refrained from reporting this as a bug.

However, I think that this puts us into an unfortunate situation:

  1. Most importantly, code is far more often read than written. This is why personally I would not be willing to sacrifice readability for DRYness.

  2. But also, CPP is a real challenge for tooling. This does not only affect you if you work on a package that makes heavy use of CPP. It also makes it difficult to e.g. implement a "go to definition" that works across packages. By my book less CPP is always a good thing.

  3. For me, the final straw is that it's not only filepath, but that I see a spreading pattern here (directory, file-io, ...).

sol avatar Jul 02 '23 11:07 sol

There's supposedly a way without CPP: https://discourse.haskell.org/t/pre-ghc-proposal-instantiate-backpack-signatures-when-importing/6739/17

hasufell avatar Jul 02 '23 11:07 hasufell

Backpack would not be my first choice.

sol avatar Jul 02 '23 11:07 sol

Backpack would not be my first choice.

This does not require backpack. See the comment:

If we’re spitballing alternative methods of achieving backpack…

You could possibly also use convenience 3 internal libraries, make them share the same source module that you want to have multiple implementations, but each import their parameter (types, implementations) from a module in isolated source directories. To instantiate them you’d use PackageImports. No CPP required (although could be used).

That would serve the local project case, but wouldn’t serve the open world case that backpack does.

hasufell avatar Jul 02 '23 12:07 hasufell

That sounds much better. But at least for file-io it could be even simpler. PR coming.

sol avatar Jul 02 '23 12:07 sol

https://github.com/hasufell/file-io/pull/9

sol avatar Jul 02 '23 12:07 sol

If you want to do the same for filepath, feel free... but it's going to be a little more work.

hasufell avatar Jul 04 '23 04:07 hasufell