<div dir="ltr">Thank you very much.<div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><b style="font-weight:normal"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:10pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">Thanks and Best Regards,</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:10pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">Ahmad Ismail</span></p></b></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Nov 13, 2022 at 9:22 PM Francesco Ariis <<a href="mailto:fa-ml@ariis.it">fa-ml@ariis.it</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">Il 13 novembre 2022 alle 20:56 Ahmad Ismail ha scritto:<br>
> How can I fix it so that `ItDoesnt <*> WhatThisIsCalled` works?<br>
> <br>
> I have came up with a solution without WhatThisIsCalled<br>
> <br>
> data WhoCares a = ItDoesnt | Matter a deriving (Eq, Show)<br>
> <br>
> instance Functor WhoCares where<br>
> fmap _ ItDoesnt = ItDoesnt<br>
> fmap f (Matter a) = Matter (f a)<br>
> <br>
> instance Applicative WhoCares where<br>
> pure = Matter<br>
> Matter f <*> Matter a = Matter (f a)<br>
> ItDoesnt <*> _ = ItDoesnt<br>
> _ <*> ItDoesnt = ItDoesnt<br>
> <br>
> instance Monad WhoCares where<br>
> return x = Matter x<br>
> (Matter x) >>= k = k x<br>
> ItDoesnt >>= _ = ItDoesnt<br>
<br>
This makes much more sense. Now <*> is total and >>= is meaningful,<br>
well done!<br>
_______________________________________________<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>