<p dir="ltr">Words?<br>
Sentences? </p>
<p dir="ltr">--<br>
--</p>
<p dir="ltr">Sent from an expensive device which will be obsolete in a few months! :D</p>
<p dir="ltr">Casey<br>
</p>
<div class="gmail_quote">On Jun 25, 2015 3:48 AM, "Imants Cekusins" <<a href="mailto:imantc@gmail.com">imantc@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">module BasicApplicative where<br>
<br>
<br>
-- 2 arg<br>
upd2:: Int -> Int -> Int<br>
upd2 x1 x2 = x1 * x2<br>
<br>
-- 3 arg<br>
upd3:: Int -> Int -> Int -> Int<br>
upd3 x1 x2 x3 = x1 * x2 + x3<br>
<br>
<br>
-- pure<br>
pureMaybe::Int -> Maybe Int<br>
pureMaybe = pure<br>
<br>
pureList::Int -> [Int]<br>
pureList = pure<br>
<br>
<br>
-- maybe<br>
maybe2::Maybe Int -> Maybe Int -> Maybe Int<br>
maybe2 mi1 mi2 = upd2 <$> mi1 <*> mi2<br>
<br>
<br>
-- list<br>
list2::[Int] -> [Int] -> [Int]<br>
list2 l1 l2 = upd2 <$> l1 <*> l2<br>
<br>
-- same result as list2<br>
list2p::[Int] -> [Int] -> [Int]<br>
list2p l1 l2 = pure upd2 <*> l1 <*> l2<br>
<br>
<br>
list3::[Int] -> [Int] -> [Int] -> [Int]<br>
list3 l1 l2 l3 = upd3 <$> l1 <*> l2 <*> l3<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">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>