elm-community / result-extra

Convenience functions for working with Result.

Home Page:http://package.elm-lang.org/packages/elm-community/result-extra/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add function to also combine errors

ad-si opened this issue · comments

There already exists:

combine : List (Result x a) -> Result x (List a)

But I'm missing a

combineErr : List (Result x a) -> Result (List x) (List a)

Should this be added?

commented

ResultME.combineList from the-sett's error-handling is similar

type alias ResultME err a =
    Result (Nonempty err) a

combineList : List (ResultME err a) -> ResultME err (List a)
  • The error list in the combined Result is Nonempty
  • also the input results are Results with Nonempty errors

You could throw a PR in there with a version fromCombinedList (short for List.map fromResult >> combineList)