<div dir="auto"><div>'s' here is not a type variable, it's an actual variable. \s -> (s, s) defines a lambda function which takes any value, and returns a tuple with that value in both positions.<div dir="auto"><br></div><div dir="auto">So yes, get is point-free, but the missing argument is right there in-line. And yes, its type is simply implied from context.</div><br><div class="gmail_extra"><br><div class="gmail_quote">On Aug 1, 2017 4:17 PM, "Olumide" <<a href="mailto:50295@web.de">50295@web.de</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ahoy Haskellers,<br>
<br>
In the section "Getting and Setting State" (<a href="http://learnyouahaskell.com/for-a-few-monads-more#state" rel="noreferrer" target="_blank">http://learnyouahaskell.com/f<wbr>or-a-few-monads-more#state</a>) in LYH get is defined as<br>
<br>
get = state $ \s -> (s, s)<br>
<br>
How does does get determine the type s, is considering that it has no argument as per the definition given above? Or is the definition written in some sort of point-free notation where an argument has been dropped?<br>
<br>
I find the line stackNow <- get in the the function(?) stackyStack confusing for the same reason. I guess my difficulty is that state $ \s ->(s , s) has a generic type (s) whereas the stackyStack has a concrete type. Is the type of s determined from the type of the stateful computation/do notation?<br>
<br>
Regards,<br>
<br>
- Olumide<br>
______________________________<wbr>_________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bi<wbr>n/mailman/listinfo/beginners</a><br>
</blockquote></div><br></div></div></div>