Sam Mohr said:
Monica try throwing the identity function at https://www.roc-lang.org/builtins/List#mapTry
whenever "pass the identity function" is the best answer, I always suspect there's a missing function in the API, and this seems like one of those situations :big_smile:
what would be a good name for a function like this to add to List?
List (Result ok err) -> Result (List ok) err
maybe List.tryAll or something like that?
perhaps List.try
Did these _already_ get "tried" by virtue of already being results (rather than tasks)? I don't recall if there's a naming precedent established for this kind of thing in Roc yet.
And does it make more sense to have lists know about results rather than results knowing about lists?
A list seems more fundamental to me, thus the result module knowing about any number of things seems more natural than the list module knowing directly about list elements representing failure.
Maybe adding the function to Result, like sequence with Task would be easier to learn.
sequence : List (Result ok err) -> Result (List ok) err
I think for result specifically mirroring Result.try with Result.tryAll makes most sense.
sequence/sequential makes sense on Task cause they are actually run in order.
Results are already generated outputs. On top of that, this would only be for List not for generic sequences.
Result.tryAll is a good option! I like that it is concise, but still tells the reader "we're working with a list of results". I think List.tryis less obvious on that front.
Last updated: Jun 16 2026 at 16:19 UTC