Stream: beginners

Topic: roc docs hangs when using types from platform


view this post on Zulip Artur Domurad (Jun 28 2024 at 14:59):

Hi,

I'am not able to generate docs for a package that is depending on a platform.

Here is my main.roc:

package [
    Math,
] {
    pf: "https://github.com/roc-lang/basic-cli/releases/download/0.11.0/SY4WWMhWQ9NvQgvIthcv15AUeA7rAIJHAHgiaSHGhdY.tar.br",
}

And here is my Math.roc:

module [add]

import pf.Task

## add a + b
add = \a, b ->
    a + b

roc docs ./main.roc just hangs and nothing happens.

When the import is commented out:

# import pf.Task

then the docs are generated instantly.

Am I doing something wrong?

// I'm using the latest roc nighly

view this post on Zulip Anton (Jun 28 2024 at 15:15):

Hi Artur,
packages can not have a platform, so I expect that is the problem. Can you make an issue? We should produce a nice error message in this case.

view this post on Zulip Artur Domurad (Jun 28 2024 at 15:17):

Hmm, but I do have a package that is a thin http client wrapper, and it uses the Task and Http modules from basic-cli.
And it is running without any problem.
Only the docs won't generate.

view this post on Zulip Anton (Jun 28 2024 at 15:24):

Ok :p this is the first package I've seen that uses a platform. I will summon @Richard Feldman to make sure :)

view this post on Zulip Brendan Hansknecht (Jun 28 2024 at 15:26):

Packages aren't supposed to be able to import from platforms

view this post on Zulip Brendan Hansknecht (Jun 28 2024 at 15:26):

This is where module params are supposed to be required

view this post on Zulip Brendan Hansknecht (Jun 28 2024 at 15:27):

The package should indirectly depend on the platform through passed in functions.

view this post on Zulip Brendan Hansknecht (Jun 28 2024 at 15:28):

That said, I'm not sure the exact state today (for example, no task as built-in yet and probably no specific code to restrict imports)

view this post on Zulip Artur Domurad (Jun 28 2024 at 15:29):

I know that module params will solve this issue.
But for now, this is the only way to write e.g. webdriver client package :D

view this post on Zulip Anton (Jun 28 2024 at 15:30):

Yeah, I would go with forking basic-cli for now

view this post on Zulip Brendan Hansknecht (Jun 28 2024 at 15:33):

I think the "correct" way to do that today would be to pass in lambdas to each function. Probably a struct of lambdas that contain a set of functions you might need.

view this post on Zulip Artur Domurad (Jun 28 2024 at 15:40):

ok, thanks for help.
Can't wait for the module params :heart:

view this post on Zulip Anton (Jun 28 2024 at 16:35):

We should produce a nice error message in this case.

I made #6850 for this.


Last updated: Jul 05 2025 at 12:14 UTC