elm-community / maybe-extra

Convenience functions for working with Maybe.

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docu (of the or-function, but maybe also other places) uses infix function syntax, which was abolished in Elm 0.18

jvoigtlaender opened this issue · comments

I'm happy to take a look at fixing this, but it does possibly expose a larger issue.

As far as I know, the suggested replacement for infix functions was to use |>. If we drop that in directly we get Just 4 |> or (Just 5) == (Just 5) which doesn't match the previous behaviour of Just 4 `or` Just 5 == Just 4. This is why quite a few functions in other libs had their argument order swapped.

You're probably already aware of that, so I'll just jump to my question: would we prefer to:

  • rewrite the docs with the |> operator, and the heuristically "wrong" behaviour mentioned above?
  • just rewrite it to use or (Just 4) (Just 5) == (Just 4)?
  • swap the order of the args to or so we can have Just 4 |> or (Just 5) == Just 4?

Swapping the order of args to or makes no sense to me. That's what orElse is for. Actually, that's exactly why the current documentation of orElse already says that it is the piping-friendly version of or.

So, concretely, I think the way to go for or is to write or (Just 4) (Just 5) == Just 4 etc. in the documentation.

Sounds good. Will do that now.

Sure thing.