Stream: beginners

Topic: ✔ Type alias definitions may not use inferred types


view this post on Zulip Jonas Schell (Sep 22 2024 at 13:41):

According to the tutorial (https://www.roc-lang.org/tutorial#underscore) we should be able to use type alias definitions with inferred types.
But this RunErr : _ gives me this warning: Type alias definitions may not use inferred types (* _*).
Seems like either the tutorial is outdated or there is something going on on the compiler side.
Minimal example:

app [main] {
    pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br",
}

import pf.Stdout

main : Task {} [Exit I32 Str]
main =
    run
    |> Task.mapErr handleErr

RunErr : _

handleErr : RunErr -> [Exit I32 Str]
handleErr = \err ->
    when err is
        StdoutErr e -> Exit 1 "Error happend: $(Inspect.toStr e)"

run : Task {} RunErr
run =
    Stdout.line "Hello World"

Roc Version:

roc version                                                                                                                                                               15:42:27
roc nightly pre-release, built from commit 3215a8f3d7 on Wed Sep 18 09:14:00 UTC 2024

view this post on Zulip Anton (Sep 22 2024 at 14:38):

Looks like this error message was added by @Richard Feldman 4 months ago, I'll remove this from the tutorial.
Thanks for reporting it @Jonas Schell!

view this post on Zulip Notification Bot (Sep 22 2024 at 14:39):

Jonas Schell has marked this topic as resolved.


Last updated: Jul 06 2025 at 12:14 UTC