<div dir="ltr">In <span style="color:rgb(33,33,33);font-family:"helvetica neue",helvetica,arial,sans-serif"><span class="inbox-inbox-Apple-converted-space"> </span>f <*> g = \x -> f x (g x), </span>g is the second argument to <*>. The result of f <*> g is a function that takes an argument (x) and gives f x (g x). So basically <*> combines the functions f and g in a particular way to give a new function. In fact, it is the only way to combine them that type checks (and doesn't use undefined or similar).</div><br><div class="gmail_quote"><div dir="ltr">On Mon, Aug 22, 2016 at 11:13 AM Imants Cekusins <<a href="mailto:imantc@gmail.com">imantc@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">.. actually, I got fg wrong. Caught it by changing g to (/ ):<div><br></div><div><div><br></div><div>f::Fractional f => f -> f -> f</div><div>f = (+)</div><div><br></div><div>g::Fractional g => g -> g</div><div>g a = a / 2</div><div><br></div><div>h::Fractional h => h -> h</div><div>h = (* 10)</div><div><br></div><div><br></div><div>fg::Fractional a => a -> a -> a</div></div></div><div dir="ltr"><div><div>fg = f <$> g</div></div></div><div dir="ltr"><div><div>{- fg a b = (a / 2) + b</div><div> fg a = \b -> (a / 2) + b</div><div>-}</div><div><br></div><div>fgh::Fractional a => a -> a</div></div></div><div dir="ltr"><div><div>fgh = fg <*> h</div></div></div><div dir="ltr"><div><div>{- fgh a = fg a (a * 10)</div><div> fgh = \a -> fg a (a * 10)</div><div>-}</div></div><div><br></div></div>
_______________________________________________<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-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>