What should the behaviour be for a tag union that is imported from an "internal" module be? Should the tags be included in docs when we run roc docs
?
Below is an example from basic-cli/blob/main/src/Dir.roc.
There is nothing generated for ReadErr
in the docs. I guess we could manually include the types in a doc comment with ##
but that seems like a bad idea for maintainability. I imagine users will want to know what the possible error types are so they can handle these if needed.
# In basic-cli/src/Dir.roc
ReadErr : InternalDir.ReadErr
# In basic-cli/src/InternalDir.roc
ReadErr : [
NotFound,
Interrupted,
InvalidFilename,
PermissionDenied,
TooManySymlinks, # aka FilesystemLoop
TooManyHardlinks,
TimedOut,
StaleNetworkFileHandle,
NotADirectory,
OutOfMemory,
Unsupported,
Unrecognized I32 Str,
]
Do we need internal read error anymore
I think it was needed to work around glue limitations at the time
Interesting, I wonder if that is the same for all of the InternalX
modules? Or is this related to opaque types somehow? like maybe this is the way to "hide" implementation details.
@Richard Feldman do you have any thoughts on this? I can make some changes while I'm looking at this today.
Luke Boswell said:
Interesting, I wonder if that is the same for all of the
InternalX
modules? Or is this related to opaque types somehow? like maybe this is the way to "hide" implementation details.
yeah that's the point of InternalX
- it's a way to say "my sibling modules can access this, but nobody outside our package can access it"
separately, before docs generation was aware of which modules were exported from a package, it had a hack that would look for the string "Internal" in the module name, and if it saw that, hide it from the docs :laughing:
but today it's actually aware of what's exposed, so that hack is gone
Why wouldn't we want read error and related types as exposed types? Why are they internal?
oh, they are exposed - via Dir
interface Dir
exposes [ReadErr, DeleteErr, DirEntry, deleteEmptyDir, deleteRecursive, list]
imports [Effect, Task.{ Task }, InternalTask, Path.{ Path }, InternalPath, InternalDir]
ReadErr : InternalDir.ReadErr
another use of Internal is avoiding cyclic dependencies
Screen-Shot-2023-06-11-at-11.30.00.png
although I forget if there was a cyclic dep issue here that InternalDir
was solving...it's been awhile since I've looked at that code! :big_smile:
This is what the docs looks like, I just feel like it would be good to see these errors enumerated. Otherwise a user will need to dig into the platform implementation to know what these are and handle them
oh yeah for sure
I think the issue here is just that docs gen is not doing what it ideally should
Ohk, so re-exporting something from a sibling "InternalX" package should be visible in the docs?
I think what it should do is:
What about our opaque types? They should also render nothing I guess, even if they are exposed?
yeah opaque types should always render nothing :thumbs_up:
Ok. Yeah, that makes sense.
Last updated: Jul 05 2025 at 12:14 UTC