I've found it confusing sometimes when working with Task and Result with the names of onErr verse onFail. I wonder if we could unify these to the same name? Should Task.onFail be renamed to Task.onErr?
This is their current type signatures:
Result.onErr : Result a err, (err -> Result a otherErr) -> Result a otherErr
Task.onFail : Task ok a, (a -> Task ok b) -> Task ok b
Note that both Result ok err and Task ok err are defined using err
I've been wondering the same thing...if we did that, should we rename Task.succeed to Task.ok?
so both of them would have ok and err
I'll write an example to see how it looks
Command.new "ls"
|> Command.arg "-al"
|> Command.arg dir
|> Command.output
|> Task.attempt \output ->
when output.status is
Ok {} ->
output.stdout
|> Str.split "\n"
|> Task.ok
Err (ExitCode code) ->
codeStr = Num.toStr code
Task.err "ls failed with exit code \(codeStr)"
Err KilledBySignal ->
Task.err "ls was killed by signal"
Err (IOError err) ->
Task.err "ls failed with IOError \(err)"
So we would have to also change Task.fail to Task.err too I assume
yeah I think so
looks fine to me!
curious what others think
Task.ok looks weird to be, but I'll get used to it and I think unifying the api with Result will be nice.
Submitted PR #64 with this change.
Last updated: Jun 16 2026 at 16:19 UTC