<div dir="ltr">How would such Applicative-based instances intended to be written?<div><br></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> instance (Applicative f, Eq a) => Eq (Ap f a) where</span><br></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> (==) = liftA2 (==)</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">That does not typecheck, and I don't believe it's possible to write something like this. Still, I would prefer</span></div><div><br></div><div> instance (Eq1 f, Eq a) => Ap f a</div><div><br></div><div>to the approach that uses FlexibleContexts.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 11, 2018 at 1:25 PM, Ryan Scott <span dir="ltr"><<a href="mailto:ryan.gl.scott@gmail.com" target="_blank">ryan.gl.scott@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">One thing that is not clear to me: is this Ap type intended to be a<br>
catch-all for defining instances that are "lifted" through an<br>
Applicative? Or are you deliberately restricting that to the Semigroup<br>
and Monoid instances? For instance, I noticed that you currently<br>
derive Ap's Eq, Ord, Read, and Show instances, which would give:<br>
<br>
instance Eq (f a) => Eq (Ap f a)<br>
instance Ord (f a) => Ord (Ap f a)<br>
instance Read (f a) => Read (Ap f a)<br>
instance Show (f a) => Show (Ap f a)<br>
<br>
Would you not want this instead, to be in line with the Semigroup and<br>
Monoid instances?<br>
<br>
instance (Applicative f, Eq a) => Eq (Ap f a)<br>
instance (Applicative f, Ord a) => Ord (Ap f a)<br>
instance (Applicative f, Read a) => Read (Ap f a)<br>
instance (Applicative f, Show a) => Show (Ap f a)<br>
<br>
I would be fine with either option, but if we should be clear about<br>
Ap's intentions when we end up documenting it.<br>
<br>
Ryan S.<br>
______________________________<wbr>_________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/libraries</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">-Andrew Thaddeus Martin</div>
</div>