dhall-haskell icon indicating copy to clipboard operation
dhall-haskell copied to clipboard

`dhall-docs` import's that don't resolve to a file makes the link return a 404

Open german1608 opened this issue 4 years ago • 2 comments

This was found at #1959

It'd be great for dhall-docs to report to the user that the import is missing with a log-warning. A solution would be to type-check every file, changing the base path on each one so relative paths are checked properly.

german1608 avatar Aug 02 '20 18:08 german1608

Type-checking the file is not enough since the import could not have a .dhall extension that dhall-docs uses for file scanning.

We might manually check the imports of each file traversing the AST, reporting a 404 if the import doesn't exist.

Another option would be to make dhall-docs to receive a package.dhall (or an entry point for the package, even a dhall expression) instead of the folder and fetch all transitive file imports (and reporting 404 on the way). What do you think of this? This would remove the constraint of having each file to have the .dhall extension, though tt's awkward that after some users started to write their documentation using that constraint would note that it's not needed anymore though.

Also, it'd be great to generate documentation from an URL like:

dhall-docs --input "https://raw.githubusercontent.com/dhall-lang/dhall-lang/v17.1.0/Prelude/package.dhall"

What do you think? @sjakobi @Gabriel439

german1608 avatar Aug 02 '20 18:08 german1608

@german1608: We have utilities in the Dhall.Import for resolving imports relative to a file so that you don't need to interpret the code

Gabriella439 avatar Aug 02 '20 18:08 Gabriella439