elm-community / elm-faq

FAQ about the Elm language.

Home Page:https://faq.elm-community.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Give definition of =>

RJWoodhead opened this issue · comments

It might help us clueless newbies if you gave the definition of => in addition to explaining how it's used.

I think it's:

(=>) : a -> b -> ( a, b )
(=>) a b =
( a, b )

Right?

I've seen it defined as (=>) = (,), which is operationally equivalent to the definition you gave. That's what the item means by calling it a synonym.

But if that's confusing we could add the definition you gave.

Thanks for the quick reply.

I think the root of the problem is that the meaning of (,) isn't clear to newbies; it's not explicitly explained that you can do stuff like (,) "fred" "barney" or use extra commas like (,,,), and a websearch for enlightenment doesn't help much; for example, the cheat sheet at https://github.com/izdi/elm-cheat-sheet shows it as an example but only in passing. There's no mention of it on https://guide.elm-lang.org/core_language.html either! The only reference I found (after a lot of searching, after I knew exactly what to look for) was buried in http://www.elm-lang.org/docs/syntax -- easy to miss (I certainly did, multiple times).

Once it was explained to me that (,) is the prefix tuple function (on slack) then all became a lot more clear.

Perhaps the takeaway is that it might be good for (,) to have a FAQ entry, and the entries for (,) and (=>) should reference each other?

I just added this item: http://faq.elm-community.org/#what-does--mean-1

Does that resolve this issue?