Stream: ideas

Topic: alternate name for Task.succeed


view this post on Zulip Richard Feldman (Mar 15 2023 at 00:07):

Task.succeed is a pretty long name to write out. What if we called it Task.ok instead? :thinking:

view this post on Zulip Nick Hallstrom (Mar 15 2023 at 00:11):

Would that mean changing Task.fail to Task.err as well?

view this post on Zulip Richard Feldman (Mar 15 2023 at 00:13):

that would make sense to me, sure :thumbs_up:

view this post on Zulip Richard Feldman (May 23 2024 at 16:50):

now that we have ! I'd like to revisit this

view this post on Zulip Richard Feldman (May 23 2024 at 16:51):

we have the convention of always using ! at the end of branches, which I like!

view this post on Zulip Richard Feldman (May 23 2024 at 16:51):

e.g.

if foo then
    Stdout.line! "blah"
else
    Stdout.line! "something"

view this post on Zulip Richard Feldman (May 23 2024 at 16:53):

however, it looks strange to me to follow this convention with Task.ok and Task.err :sweat_smile:

e.g.

answer =
    if foo then
        Stdin.line!
    else
        Task.ok! "something"

view this post on Zulip Richard Feldman (May 23 2024 at 16:53):

Task.succeed! and Task.fail! feel more natural to me compared to Task.ok! and Task.err!

however, it looks strange to me to follow this convention with Task.ok and Task.err :sweat_smile:

e.g.

answer =
    if foo then
        Stdin.line!
    else
        Task.succeed! "something"

view this post on Zulip Richard Feldman (May 23 2024 at 16:53):

I'm curious what others think!

view this post on Zulip Isaac Van Doren (May 23 2024 at 17:09):

Task.ok doesn’t look strange to me here so my preference would be to keep it because it is shorter

view this post on Zulip Brendan Hansknecht (May 23 2024 at 18:13):

They look pretty evenly strange to me.

view this post on Zulip Brendan Hansknecht (May 23 2024 at 18:13):

But I am used to Ok(...) from all of the rust

view this post on Zulip Norbert Hajagos (May 24 2024 at 08:11):

Succeed makes more sense, but I really like that I don't have to parse Task.ok in my mind. It is so short that just glancing at it I know the meaning of that expression. Task.succeed is just long enaugh to not fall into this category. Besides that, I don't think Task.ok! ... seems strange.


Last updated: Jun 16 2026 at 16:19 UTC