Stream: beginners

Topic: Nothing is named `Task` in this scope


view this post on Zulip Ian Erik Varatalu (Dec 03 2022 at 00:17):

How do i use tasks in function declarations?

i tried to make this example and it won't let me

doSomething : {} -> Task Str *
doSomething = \{} -> Task.succeed "Hi"

i'm using these imports

imports [
        pf.Stdout,
        pf.Stdin,
        pf.Task.{ await },
        pf.Task
    ]

view this post on Zulip Richard Feldman (Dec 03 2022 at 01:18):

try replacing the last two lines of the imports with:

pf.Task.{ Task, await }

view this post on Zulip Richard Feldman (Dec 03 2022 at 01:19):

that basically says "import the pf.Task module and bring the Task type and the await function into my local scope"

view this post on Zulip Ian Erik Varatalu (Dec 03 2022 at 02:18):

Okay now it works, thanks!


Last updated: Jul 06 2025 at 12:14 UTC