Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax overview does not explain the mysterious .s and $s #19

Closed
rodrigob opened this issue Jan 11, 2013 · 9 comments
Closed

Syntax overview does not explain the mysterious .s and $s #19

rodrigob opened this issue Jan 11, 2013 · 9 comments

Comments

@rodrigob
Copy link

When looking at simple examples like

http://elm-lang.org/edit/examples/Reactive/TextField.elm

The main source of mystery mights come from the lifting operators (<~) and the .s and $s

Neither of them are mentioned in http://elm-lang.org/learn/Syntax.elm which is where I would expect to find the explanation.

@ghost
Copy link

ghost commented Jan 11, 2013

I'm still trying to wrap my head around this entire paradigm (functional programming, FRP, etc) and its syntax. However, I'm pretty sure (.) and ($) in Elm work exactly like this: http://stackoverflow.com/questions/940382/haskell-difference-between-dot-and-dollar-sign. Hopefully that link gives you something to mull over and experiment with until someone knowledgable can answer more concretely.

@rodrigob
Copy link
Author

Thanks for the pointer, but I still think this should be explained in the syntax page, or the syntax page should mention "we expect you to be familiar with Haskell syntax" (or something like that).
This was not a "I do not understand how to use Elm" message it is a "I think the webpage could be improved a little bit if..." message.

@ghost
Copy link

ghost commented Jan 11, 2013

Oh, my bad! I thought you were asking a question. Anyway, I agree. The current information on the syntax page is great if you already have a background in a similar language. However, if you come from a more imperative-style of programming, like myself, you'll find yourself spending a lot of time reading about Haskell syntax and general concepts before you can even experiment with Elm productively.

Alongside your points on the (.) and ($) operators perhaps we can pool some ideas here (or open an issue specifically for this) to make learning Elm and little easier for newcomers? For example, if the concept of "lifting" was explained on the site with a few examples I think I would've been able to experiment a little easier. Lifting is brought up briefly on the "What is FRP" page, but I don't think it does the concept justice at all.

@evancz
Copy link
Member

evancz commented Jan 12, 2013

Did you both start looking at Elm after the 0.7 release? That's when the alternative lift syntax (<~) and the record accessor syntax (.label) got introduced, and I was worried that it would cause exactly this kind of confusion.

I'll add something to the syntax page about it, but do you think I should just stick to using lift in all of the examples? That's how it was before, and I suspect it localized the confusion to understanding how lift works.

Also, what would help in understanding lift? There is no central document on that, but until the 0.7 release, a bunch of the examples were dedicated to showing how to use it. Now many of them use the (<~) though, making these examples seem less related to lifting functions onto signals perhaps.

@ghost
Copy link

ghost commented Jan 13, 2013

Yes, I was following the project sometime before but I did not start looking at the examples until after 0.7.

If you want to keep the whole "learn by example" feel to the site I think switching back to using lift in the examples (at least the basic examples) and making a note in the comments about the alternative syntax (<~) would make things less confusing for beginners.

@rodrigob
Copy link
Author

I started before 0.7, I would agree than explicit lift would make it easier for beginners. For me the key it is to be able to quickly "find the answers" (since <~ is harder to google around, then lift is better).

As a suggestion, for the examples section, having hyperlinking from the source code the documentation would be awesome. You see code, "what the lift function ?", click on the function and jump to the relevant documentation.

Obviously this conflicts with the "right away editable", but this seems not insurmountable (hot hyperlinking, or switch between read and edit mode; most demos would be in read mode by default).

@evancz
Copy link
Member

evancz commented Jan 15, 2013

I have locally changed things back to using lift and added more explanation of (<~) in the syntax reference, so that should get pushed to the main site soon.

On the topic of adding tighter integration with the relevant documentation, it looks like madscoaducom is working on just that!

@tomberek
Copy link
Contributor

Everything has been answered except for $.
Unless I'm wrong, $ has been depreciated in favor of <| and |>
http://docs.elm-lang.org/library/Basics.elm#%3C|

Recommend adding docs.
#66

@evancz
Copy link
Member

evancz commented Oct 31, 2013

Great :) We'll see if more ($) questions come up and reassess then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants