<div dir="auto"><div dir="auto">Hi,</div><div dir="auto"><br></div>a -> b is the type of a function taking arguments of a generic type (we call it a) and returning results of another type, that we call b.<div dir="auto"><br></div><div dir="auto">So </div><div dir="auto">(a -> b ) -> [a] -> [b]</div><div dir="auto">Means that you have a first argument that is a function (a-> b), a second argument that is a list of elements of the same type of the function input, and that the returned element is a list of things of the type of the output of the function.</div><div dir="auto"><br></div><div dir="auto">Cheers,</div><div dir="auto">Ut</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il ven 18 dic 2020, 23:02 Lawrence Bottorff <<a href="mailto:borgauf@gmail.com">borgauf@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thank you, but why in <div><br><div><font face="monospace">map :: (a -> b) -> [a] -> [b]<br></font></div><div><br></div><div>are there parentheses around <font face="monospace">a -> b</font> ? In general, what is the currying aspect of this?</div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Dec 18, 2020 at 12:43 PM David McBride <<a href="mailto:toad3k@gmail.com" target="_blank" rel="noreferrer">toad3k@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>They are not parameters, they are the types of the parameters.</div><div><br></div><div>In this case a can really be anything, Int, Char, whatever, so long as the function takes a single argument of that type and the list that is given has elements of that same type.</div><div>It is the same for b, it doesn't matter what b ends up being, so long as when you call that function the function's return value is compatible with the element type of the list that you intended to return from the entire statement.<br></div><div><br></div><div>You can mess with it yourself in ghci to see how type inference works.<br></div><br><div>>:t show<br>:show :: Show a => a -> String<br>>:t map show<br>map show :: Show a => [a] -> [String]</div><div>> :t flip map [1::Int]</div><div>> flip map [1::Int] :: (Int -> b) -> [b]<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Dec 18, 2020 at 1:31 PM Lawrence Bottorff <<a href="mailto:borgauf@gmail.com" target="_blank" rel="noreferrer">borgauf@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I'm looking at this<div><br></div><div><font face="monospace">ghci> :type map<br>map :: (a -> b) -> [a] -> [b]</font><br></div><div><br></div><div>and wondering what the <font face="monospace">(a -> b)</font> part is about. map takes a function and applies it to an incoming list. Good. Understood. I'm guessing that the whole Haskell type declaration idea is based on currying, and I do understand how the <font face="monospace">(a -> b) </font>part "takes" an incoming list, <font face="monospace">[a]</font> and produces the<font face="monospace"> [b] </font>output. Also, I don't understand a and b very well either. Typically, <font face="monospace">a</font> is just a generic variable, then <font face="monospace">b</font> is another generic variable not necessarily the same as <font face="monospace">a</font>. But how are they being used in this type declaration?</div><div><br></div><div>LB</div></div>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank" rel="noreferrer">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank" rel="noreferrer">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank" rel="noreferrer">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>