Stream: beginners

Topic: The Task module does not expose `ok`


view this post on Zulip Noa Vidović (Jun 25 2023 at 20:27):

After importing pf.Task (using basic-cli as the platform - "https://github.com/roc-lang/basic-cli/releases/download/0.3.2/tE4xS_zLdmmxmHwHih9kHWQ7fsXtJr7W7h3425-eZFk.tar.br"), if I try to use Task.ok I get the following error:

── NOT EXPOSED ────────────────────────────────────────────────────── main.roc ─

The Task module does not expose `ok`:

30│      Task.ok {}
         ^^^^^^^

Did you mean one of these?

    Task.map
    Task.loop
    Task.fail
    Task.await

────────────────────────────────────────────────────────────────────────────────

1 error and 0 warnings found in 12 ms.

You can run the program anyway with roc run

Running the program produces the following crash error:

Roc crashed with:

    ValueNotExposed { module_name: ModuleName(IdentStr { string: "Task" }), ident: Ident(IdentStr { string: "ok" }), region: @567-574, exposed_values: ['await', 'succeed', 'fail', 'map', 'mapFail', 'onFail', 'attempt', 'forever', 'loop', 'fromResult'] }

Here is the call stack that led to the crash:

    shm.open
        /home/runner/work/roc/roc/basic-cli/src/src/lib.rs

Optimizations can make this list inaccurate! If it looks wrong, try running without `--optimize` and with `--linker=legacy`

After looking at the source code I cannot see why Task.ok would not be exposed, unless the platform release is on a version that didn't use to expose it?

If I try to do an unqualified import pf.Task.{ ok }, the error it produces is different:

── UNRECOGNIZED NAME ──────────────────────────────────────────────── main.roc ─

The Task module does not expose anything by the name ok.


── DUPLICATE NAME ─ ....2/tE4xS_zLdmmxmHwHih9kHWQ7fsXtJr7W7h3425-eZFk/Task.roc ─

The ok name is first defined here:

37│  succeed = \ok -> InternalTask.succeed ok
                ^^

But then it's defined a second time here:

48│                  Ok ok -> transform (Ok ok) |> InternalTask.toEffect
                        ^^

Since these variables have the same name, it's easy to use the wrong
one by accident. Give one of them a new name.


── DUPLICATE NAME ─ ....2/tE4xS_zLdmmxmHwHih9kHWQ7fsXtJr7W7h3425-eZFk/Task.roc ─

The ok name is first defined here:

37│  succeed = \ok -> InternalTask.succeed ok
                ^^

But then it's defined a second time here:

81│                  Ok ok -> Task.succeed (transform ok) |> InternalTask.toEffect
                        ^^

Since these variables have the same name, it's easy to use the wrong
one by accident. Give one of them a new name.


── DUPLICATE NAME ─ ....2/tE4xS_zLdmmxmHwHih9kHWQ7fsXtJr7W7h3425-eZFk/Task.roc ─

The ok name is first defined here:

37│  succeed = \ok -> InternalTask.succeed ok
                ^^

But then it's defined a second time here:

92│                  Ok ok -> Task.succeed ok |> InternalTask.toEffect
                        ^^

Since these variables have the same name, it's easy to use the wrong
one by accident. Give one of them a new name.


── DUPLICATE NAME ─ ....2/tE4xS_zLdmmxmHwHih9kHWQ7fsXtJr7W7h3425-eZFk/Task.roc ─

The ok name is first defined here:

37│  succeed = \ok -> InternalTask.succeed ok
                ^^

But then it's defined a second time here:

101│          Ok ok -> succeed ok
                 ^^

Since these variables have the same name, it's easy to use the wrong
one by accident. Give one of them a new name.


── UNRECOGNIZED NAME ─ ...tE4xS_zLdmmxmHwHih9kHWQ7fsXtJr7W7h3425-eZFk/Task.roc ─

The Task module does not expose anything by the name ok.


── UNRECOGNIZED NAME ─ ...tE4xS_zLdmmxmHwHih9kHWQ7fsXtJr7W7h3425-eZFk/Task.roc ─

The Task module does not expose anything by the name ok.


── UNRECOGNIZED NAME ─ ...tE4xS_zLdmmxmHwHih9kHWQ7fsXtJr7W7h3425-eZFk/Task.roc ─

The Task module does not expose anything by the name ok.


── UNRECOGNIZED NAME ─ ...tE4xS_zLdmmxmHwHih9kHWQ7fsXtJr7W7h3425-eZFk/Task.roc ─

The Task module does not expose anything by the name ok.


── UNRECOGNIZED NAME ─ ...tE4xS_zLdmmxmHwHih9kHWQ7fsXtJr7W7h3425-eZFk/Task.roc ─

The Task module does not expose anything by the name ok.


── UNRECOGNIZED NAME ─ ...tE4xS_zLdmmxmHwHih9kHWQ7fsXtJr7W7h3425-eZFk/Task.roc ─

The Task module does not expose anything by the name ok.


── UNRECOGNIZED NAME ─ ...tE4xS_zLdmmxmHwHih9kHWQ7fsXtJr7W7h3425-eZFk/Task.roc ─

The Task module does not expose anything by the name ok.


── UNRECOGNIZED NAME ─ ...tE4xS_zLdmmxmHwHih9kHWQ7fsXtJr7W7h3425-eZFk/Task.roc ─

The Task module does not expose anything by the name ok.


── UNRECOGNIZED NAME ─ ...tE4xS_zLdmmxmHwHih9kHWQ7fsXtJr7W7h3425-eZFk/Task.roc ─

The Task module does not expose anything by the name ok.


── UNRECOGNIZED NAME ─ ...tE4xS_zLdmmxmHwHih9kHWQ7fsXtJr7W7h3425-eZFk/Task.roc ─

The Task module does not expose anything by the name ok.


── UNRECOGNIZED NAME ─ ...tE4xS_zLdmmxmHwHih9kHWQ7fsXtJr7W7h3425-eZFk/Task.roc ─

The Task module does not expose anything by the name ok.

────────────────────────────────────────────────────────────────────────────────

16 errors and 0 warnings found in 15 ms.

You can run the program anyway with roc run

view this post on Zulip Kilian Vounckx (Jun 25 2023 at 20:31):

Task.ok was created after that release. It was renamed from Task.succeed, so using that should work. There is an unstable 4.0 release, or you could clone the repository and use a local platform as well with pf: "./path/to/basic-cli/src/main.roc

view this post on Zulip Noa Vidović (Jun 25 2023 at 20:44):

Thank you!

view this post on Zulip Noa Vidović (Jun 25 2023 at 20:48):

It might be wise to have the documentation reflect the latest release, instead of the current git version

view this post on Zulip Luke Boswell (Jun 25 2023 at 23:00):

Oh wow, docs for basic-cli are back up and running, awesome. :tada:

view this post on Zulip Luke Boswell (Jun 25 2023 at 23:01):

@Anton is it easy enough to have docs build from the latest release? I guess if someone is using source they can generate docs locally.

view this post on Zulip Anton (Jun 26 2023 at 10:04):

I'll set up docs for 0.3.2, 0.4.0 and the latest git version

view this post on Zulip Anton (Jul 11 2023 at 10:32):

@Noa Vidović documentation for basic-cli 0.3.2 is available now: https://www.roc-lang.org/packages/basic-cli/0.3.2


Last updated: Jul 06 2025 at 12:14 UTC