<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><i class="">'Much better if you let us know the source of this problem. Is this an exercise from some book / online course?”</i></div><div class=""><br class=""></div><div class="">The source is just me exploring. </div><div class="">I first looked at </div><div class=""><br class=""></div><div class="">data C a = C a deriving (Show)</div><div class=""><br class=""></div><div class="">and made Monad, Applicative, Monoid and Functors for it.</div><div class=""><br class=""></div><div class="">So then tried </div><div class="">Pair a = P (a, a)  </div><div class="">and stuck on Monad.</div><div class=""><br class=""></div><div class="">Thanks<span class="Apple-tab-span" style="white-space:pre">   </span></div><div class=""><br class=""></div><div class="">Mike</div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 18 Nov 2015, at 07:23, Kim-Ee Yeoh <<a href="mailto:ky3@atamo.com" class="">ky3@atamo.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Nov 18, 2015 at 4:41 AM, Mike Houghton <span dir="ltr" class=""><<a href="mailto:mike_k_houghton@yahoo.co.uk" target="_blank" class="">mike_k_houghton@yahoo.co.uk</a>></span> wrote:<br class=""><br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":132" class="a3s" style="overflow:hidden">
And really return x  = P (x, x) doesn’t seem correct anyway.<br class=""></div></blockquote><div class=""><br class=""></div><div class="">But if you look at the type, which is essentially "a -> (a,a)" there's only one way to write it, for the same reason that there's only one "a -> a" function.<br class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":132" class="a3s" style="overflow:hidden">
Would someone please write the Monad with an explanation?</div></blockquote></div><br class=""></div><div class="gmail_extra">Much better if you let us know the source of this problem. Is this an exercise from some book / online course?<br class=""></div><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="gmail_signature">-- Kim-Ee</div></div>
</div></div>
_______________________________________________<br class="">Beginners mailing list<br class=""><a href="mailto:Beginners@haskell.org" class="">Beginners@haskell.org</a><br class=""><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" class="">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br class=""></div></blockquote></div><br class=""></body></html>