<div dir="ltr"><div>Hey David,</div><div>could you exposit what would go wrong? a concrete proof witness or explanation would help me a lot. other people might benefit too.<br></div><div><br></div><div><br></div><div>for the stateT s Maybe a, perhaps i'm still waking up this AM, so let me try <br></div><div>newtype StateT s m a = StateT {runStateT :: s -> m (a, s)}</div><div><br></div><div>so this should expand to  <br></div><div>'(s -> Maybe (a,s)),'</div><div> but the coerce would be on the 'a' here ... so i'm not seeing the issue?<br></div><div><br></div><div><br></div><div><br></div><div>the latter example seem to boil down to "a free appplicative/functor Gadt" with some extra bits, though i've not worked through to seeing the unsafety <br></div><div>for the latter examples, the definitions are the following : <br></div><div><pre><span id="m_5071564298494191785gmail-local-6989586621679090271"><span id="m_5071564298494191785gmail-local-6989586621679090272"><span id="m_5071564298494191785gmail-local-6989586621679090273"><span id="m_5071564298494191785gmail-local-6989586621679090274"><span id="m_5071564298494191785gmail-local-6989586621679090275"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#traverseBia" target="_blank"><span>traverseBia</span></a></span><span> </span><span>::</span><span> </span><span>(</span><span><span>Traversable</span></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090275" target="_blank"><span>t</span></a></span><span>,</span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Biapplicative" target="_blank"><span>Biapplicative</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090274" target="_blank"><span>p</span></a></span><span>)</span><span>
</span><span id="m_5071564298494191785gmail-line-132"></span><span>            </span><span>=></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090273" target="_blank"><span>a</span></a></span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090274" target="_blank"><span>p</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090272" target="_blank"><span>b</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090271" target="_blank"><span>c</span></a></span><span>)</span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090275" target="_blank"><span>t</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090273" target="_blank"><span>a</span></a></span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090274" target="_blank"><span>p</span></a></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090275" target="_blank"><span>t</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090272" target="_blank"><span>b</span></a></span><span>)</span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090275" target="_blank"><span>t</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090271" target="_blank"><span>c</span></a></span><span>)</span></span></span></span></span></span><span>
</span><span id="m_5071564298494191785gmail-line-133"></span><span id="m_5071564298494191785gmail-traverseBia"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#traverseBia" target="_blank"><span>traverseBia</span></a></span></span><span> </span><span>=</span><span> </span><span><span>inline</span></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#traverseBiaWith" target="_blank"><span>traverseBiaWith</span></a></span><span> </span><span><span>traverse</span></span><span>)</span><span><br> --------<br><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#traverseBiaWith" target="_blank"><span>traverseBiaWith</span></a></span><span> </span><span>::</span><span> </span><span>forall</span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679090289"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090289" target="_blank"><span>p</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679090288"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090288" target="_blank"><span>a</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679090285"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090285" target="_blank"><span>b</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679090284"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090284" target="_blank"><span>c</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679090287"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090287" target="_blank"><span>s</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679090286"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090286" target="_blank"><span>t</span></a></span></span><span>.</span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Biapplicative" target="_blank"><span>Biapplicative</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090289" target="_blank"><span>p</span></a></span><span>
</span><span id="m_5071564298494191785gmail-line-160"></span><span>  </span><span>=></span><span> </span><span>(</span><span>forall</span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679090291"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090291" target="_blank"><span>f</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679090290"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090290" target="_blank"><span>x</span></a></span></span><span>.</span><span> </span><span><span>Applicative</span></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090291" target="_blank"><span>f</span></a></span><span> </span><span>=></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090288" target="_blank"><span>a</span></a></span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090291" target="_blank"><span>f</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090290" target="_blank"><span>x</span></a></span><span>)</span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090287" target="_blank"><span>s</span></a></span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090291" target="_blank"><span>f</span></a></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090286" target="_blank"><span>t</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090290" target="_blank"><span>x</span></a></span><span>)</span><span>)</span><span>
</span><span id="m_5071564298494191785gmail-line-161"></span><span>  </span><span>-></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090288" target="_blank"><span>a</span></a></span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090289" target="_blank"><span>p</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090285" target="_blank"><span>b</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090284" target="_blank"><span>c</span></a></span><span>)</span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090287" target="_blank"><span>s</span></a></span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090289" target="_blank"><span>p</span></a></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090286" target="_blank"><span>t</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090285" target="_blank"><span>b</span></a></span><span>)</span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090286" target="_blank"><span>t</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090284" target="_blank"><span>c</span></a></span><span>)</span><span>
</span><span id="m_5071564298494191785gmail-line-162"></span><span id="m_5071564298494191785gmail-traverseBiaWith"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#traverseBiaWith" target="_blank"><span>traverseBiaWith</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089877"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089877" target="_blank"><span>trav</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089876"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089876" target="_blank"><span>p</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089875"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089875" target="_blank"><span>s</span></a></span></span><span> </span><span>=</span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#smash" target="_blank"><span>smash</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089876" target="_blank"><span>p</span></a></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089877" target="_blank"><span>trav</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#One" target="_blank"><span>One</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089875" target="_blank"><span>s</span></a></span><span>)<br>-------<br><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#smash" target="_blank"><span>smash</span></a></span><span> </span><span>::</span><span> </span><span>forall</span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679090262"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090262" target="_blank"><span>p</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679090258"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090258" target="_blank"><span>t</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679090261"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090261" target="_blank"><span>a</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679090260"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090260" target="_blank"><span>b</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679090259"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090259" target="_blank"><span>c</span></a></span></span><span>.</span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Biapplicative" target="_blank"><span>Biapplicative</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090262" target="_blank"><span>p</span></a></span><span>
</span><span id="m_5071564298494191785gmail-line-166"></span><span>      </span><span>=></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090261" target="_blank"><span>a</span></a></span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090262" target="_blank"><span>p</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090260" target="_blank"><span>b</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090259" target="_blank"><span>c</span></a></span><span>)</span><span>
</span><span id="m_5071564298494191785gmail-line-167"></span><span>      </span><span>-></span><span> </span><span>(</span><span>forall</span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679090264"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090264" target="_blank"><span>x</span></a></span></span><span>.</span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Mag" target="_blank"><span>Mag</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090261" target="_blank"><span>a</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090264" target="_blank"><span>x</span></a></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090258" target="_blank"><span>t</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090264" target="_blank"><span>x</span></a></span><span>)</span><span>)</span><span>
</span><span id="m_5071564298494191785gmail-line-168"></span><span>      </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090262" target="_blank"><span>p</span></a></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090258" target="_blank"><span>t</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090260" target="_blank"><span>b</span></a></span><span>)</span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090258" target="_blank"><span>t</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090259" target="_blank"><span>c</span></a></span><span>)</span><span>
</span><span id="m_5071564298494191785gmail-line-169"></span><span id="m_5071564298494191785gmail-smash"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#smash" target="_blank"><span>smash</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089872"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089872" target="_blank"><span>p</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089871"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089871" target="_blank"><span>m</span></a></span></span><span> </span><span>=</span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089870" target="_blank"><span>go</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089871" target="_blank"><span>m</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089871" target="_blank"><span>m</span></a></span><span>
</span><span id="m_5071564298494191785gmail-line-170"></span><span>  </span><span>where</span><span>
</span><span id="m_5071564298494191785gmail-line-171"></span><span>    </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089870" target="_blank"><span>go</span></a></span><span> </span><span>::</span><span> </span><span>forall</span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679090249"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090249" target="_blank"><span>x</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679090248"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090248" target="_blank"><span>y</span></a></span></span><span>.</span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Mag" target="_blank"><span>Mag</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090261" target="_blank"><span>a</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090260" target="_blank"><span>b</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090249" target="_blank"><span>x</span></a></span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Mag" target="_blank"><span>Mag</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090261" target="_blank"><span>a</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090259" target="_blank"><span>c</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090248" target="_blank"><span>y</span></a></span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090262" target="_blank"><span>p</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090249" target="_blank"><span>x</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090248" target="_blank"><span>y</span></a></span><span>
</span><span id="m_5071564298494191785gmail-line-172"></span><span>    </span><span id="m_5071564298494191785gmail-local-6989586621679089870"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089870" target="_blank"><span>go</span></a></span></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Pure" target="_blank"><span>Pure</span></a></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089868"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089868" target="_blank"><span>t</span></a></span></span><span>)</span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Pure" target="_blank"><span>Pure</span></a></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089867"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089867" target="_blank"><span>u</span></a></span></span><span>)</span><span> </span><span>=</span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#bipure" target="_blank"><span>bipure</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089868" target="_blank"><span>t</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089867" target="_blank"><span>u</span></a></span><span>
</span><span id="m_5071564298494191785gmail-line-173"></span><span>    </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089870" target="_blank"><span>go</span></a></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Map" target="_blank"><span>Map</span></a></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089865"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089865" target="_blank"><span>f</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089864"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089864" target="_blank"><span>x</span></a></span></span><span>)</span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Map" target="_blank"><span>Map</span></a></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089863"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089863" target="_blank"><span>g</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089862"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089862" target="_blank"><span>y</span></a></span></span><span>)</span><span> </span><span>=</span><span> </span><span><span>bimap</span></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089865" target="_blank"><span>f</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089863" target="_blank"><span>g</span></a></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089870" target="_blank"><span>go</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089864" target="_blank"><span>x</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089862" target="_blank"><span>y</span></a></span><span>)</span><span>
</span><span id="m_5071564298494191785gmail-line-174"></span><span>    </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089870" target="_blank"><span>go</span></a></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Ap" target="_blank"><span>Ap</span></a></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089860"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089860" target="_blank"><span>fs</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089859"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089859" target="_blank"><span>xs</span></a></span></span><span>)</span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Ap" target="_blank"><span>Ap</span></a></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089858"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089858" target="_blank"><span>gs</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089857"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089857" target="_blank"><span>ys</span></a></span></span><span>)</span><span> </span><span>=</span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089870" target="_blank"><span>go</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089860" target="_blank"><span>fs</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089858" target="_blank"><span>gs</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#%3C%3C%2A%3E%3E" target="_blank"><span><<*>></span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089870" target="_blank"><span>go</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089859" target="_blank"><span>xs</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089857" target="_blank"><span>ys</span></a></span><span>
#if MIN_VERSION_base(4,10,0)
</span><span>    </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089870" target="_blank"><span>go</span></a></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#LiftA2" target="_blank"><span>LiftA2</span></a></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089855"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089855" target="_blank"><span>f</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089854"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089854" target="_blank"><span>xs</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089853"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089853" target="_blank"><span>ys</span></a></span></span><span>)</span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#LiftA2" target="_blank"><span>LiftA2</span></a></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089852"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089852" target="_blank"><span>g</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089851"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089851" target="_blank"><span>zs</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089850"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089850" target="_blank"><span>ws</span></a></span></span><span>)</span><span> </span><span>=</span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#biliftA2" target="_blank"><span>biliftA2</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089855" target="_blank"><span>f</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089852" target="_blank"><span>g</span></a></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089870" target="_blank"><span>go</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089854" target="_blank"><span>xs</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089851" target="_blank"><span>zs</span></a></span><span>)</span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089870" target="_blank"><span>go</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089853" target="_blank"><span>ys</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089850" target="_blank"><span>ws</span></a></span><span>)</span><span>
#endif
</span><span>    </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089870" target="_blank"><span>go</span></a></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#One" target="_blank"><span>One</span></a></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089849"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089849" target="_blank"><span>x</span></a></span></span><span>)</span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#One" target="_blank"><span>One</span></a></span><span> </span><span><span>_</span></span><span>)</span><span> </span><span>=</span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089872" target="_blank"><span>p</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089849" target="_blank"><span>x</span></a></span><span>
</span><span id="m_5071564298494191785gmail-line-179"></span><span>    </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089870" target="_blank"><span>go</span></a></span><span> </span><span><span>_</span></span><span> </span><span><span>_</span></span><span> </span><span>=</span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#impossibleError" target="_blank"><span>impossibleError</span></a></span><span><br><br></span></span></span></pre><pre><span><span><span>---- and then the magma is <br><span>
</span><span id="m_5071564298494191785gmail-line-187"></span><span>-- This is used to reify a traversal for 'traverseBia'. It's a somewhat</span><span>
</span><span id="m_5071564298494191785gmail-line-188"></span><span>-- bogus 'Functor' and 'Applicative' closely related to 'Magma' from the</span><span>
</span><span id="m_5071564298494191785gmail-line-189"></span><span>-- @lens@ package. Valid traversals don't use (<$), (<*), or (*>), so</span><span>
</span><span id="m_5071564298494191785gmail-line-190"></span><span>-- we leave them out. We offer all the rest of the Functor and Applicative</span><span>
</span><span id="m_5071564298494191785gmail-line-191"></span><span>-- operations to improve performance: we generally want to keep the structure</span><span>
</span><span id="m_5071564298494191785gmail-line-192"></span><span>-- as small as possible. We might even consider using RULES to widen lifts</span><span>
</span><span id="m_5071564298494191785gmail-line-193"></span><span>-- when we can:</span><span>
</span><span id="m_5071564298494191785gmail-line-194"></span><span>--</span><span>
</span><span id="m_5071564298494191785gmail-line-195"></span><span>--   liftA2 f x y <*> z ==> liftA3 f x y z,</span><span>
</span><span id="m_5071564298494191785gmail-line-196"></span><span>--</span><span>
</span><span id="m_5071564298494191785gmail-line-197"></span><span>-- etc., up to the pointer tagging limit. But we do need to be careful. I don't</span><span>
</span><span id="m_5071564298494191785gmail-line-198"></span><span>-- *think* GHC will ever inline the traversal into the go function (because that</span><span>
</span><span id="m_5071564298494191785gmail-line-199"></span><span>-- would duplicate work), but if it did, and if different RULES fired for the</span><span>
</span><span id="m_5071564298494191785gmail-line-200"></span><span>-- two copies, everything would break horribly.</span><span>
</span><span id="m_5071564298494191785gmail-line-201"></span><span>--</span><span>
</span><span id="m_5071564298494191785gmail-line-202"></span><span>-- Note: if it's necessary for some reason, we *could* relax GADTs to</span><span>
</span><span id="m_5071564298494191785gmail-line-203"></span><span>-- ExistentialQuantification by changing the type of One to</span><span>
</span><span id="m_5071564298494191785gmail-line-204"></span><span>--</span><span>
</span><span id="m_5071564298494191785gmail-line-205"></span><span>--   One :: (b -> c) -> a -> Mag a b c</span><span>
</span><span id="m_5071564298494191785gmail-line-206"></span><span>--</span><span>
</span><span id="m_5071564298494191785gmail-line-207"></span><span>-- where the function will always end up being id. But we allocate a *lot*</span><span>
</span><span id="m_5071564298494191785gmail-line-208"></span><span>-- of One constructors, so this would definitely be bad for performance.</span><span>
</span><span id="m_5071564298494191785gmail-line-209"></span><span>data</span><span> </span><span id="m_5071564298494191785gmail-Mag"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Mag" target="_blank"><span>Mag</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089846"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089846" target="_blank"><span>a</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089845"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089845" target="_blank"><span>b</span></a></span></span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089844"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089844" target="_blank"><span>t</span></a></span></span><span> </span><span>where</span><span>
</span><span id="m_5071564298494191785gmail-line-210"></span><span>  </span><span id="m_5071564298494191785gmail-local-6989586621679090195"><span id="m_5071564298494191785gmail-local-6989586621679090196"><span id="m_5071564298494191785gmail-local-6989586621679090197"><span id="m_5071564298494191785gmail-Pure"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Pure" target="_blank"><span>Pure</span></a></span></span><span> </span><span>::</span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090197" target="_blank"><span>t</span></a></span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Mag" target="_blank"><span>Mag</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090196" target="_blank"><span>a</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090195" target="_blank"><span>b</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090197" target="_blank"><span>t</span></a></span></span></span></span><span>
</span><span id="m_5071564298494191785gmail-line-211"></span><span>  </span><span id="m_5071564298494191785gmail-local-6989586621679089843"><span id="m_5071564298494191785gmail-local-6989586621679090216"><span id="m_5071564298494191785gmail-local-6989586621679090217"><span id="m_5071564298494191785gmail-local-6989586621679090218"><span id="m_5071564298494191785gmail-Map"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Map" target="_blank"><span>Map</span></a></span></span><span> </span><span>::</span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089843" target="_blank"><span>x</span></a></span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090218" target="_blank"><span>t</span></a></span><span>)</span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Mag" target="_blank"><span>Mag</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090217" target="_blank"><span>a</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090216" target="_blank"><span>b</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089843" target="_blank"><span>x</span></a></span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Mag" target="_blank"><span>Mag</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090217" target="_blank"><span>a</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090216" target="_blank"><span>b</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090218" target="_blank"><span>t</span></a></span></span></span></span></span><span>
</span><span id="m_5071564298494191785gmail-line-212"></span><span>  </span><span id="m_5071564298494191785gmail-local-6989586621679089839"><span id="m_5071564298494191785gmail-local-6989586621679089840"><span id="m_5071564298494191785gmail-local-6989586621679089841"><span id="m_5071564298494191785gmail-local-6989586621679089842"><span id="m_5071564298494191785gmail-Ap"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Ap" target="_blank"><span>Ap</span></a></span></span><span> </span><span>::</span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Mag" target="_blank"><span>Mag</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089842" target="_blank"><span>a</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089841" target="_blank"><span>b</span></a></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089840" target="_blank"><span>t</span></a></span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089839" target="_blank"><span>u</span></a></span><span>)</span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Mag" target="_blank"><span>Mag</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089842" target="_blank"><span>a</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089841" target="_blank"><span>b</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089840" target="_blank"><span>t</span></a></span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Mag" target="_blank"><span>Mag</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089842" target="_blank"><span>a</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089841" target="_blank"><span>b</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089839" target="_blank"><span>u</span></a></span></span></span></span></span><span>
#if MIN_VERSION_base(4,10,0)
</span><span>  </span><span id="m_5071564298494191785gmail-local-6989586621679089837"><span id="m_5071564298494191785gmail-local-6989586621679089838"><span id="m_5071564298494191785gmail-local-6989586621679090185"><span id="m_5071564298494191785gmail-local-6989586621679090186"><span id="m_5071564298494191785gmail-local-6989586621679090187"><span id="m_5071564298494191785gmail-LiftA2"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#LiftA2" target="_blank"><span>LiftA2</span></a></span></span><span> </span><span>::</span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089838" target="_blank"><span>t</span></a></span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089837" target="_blank"><span>u</span></a></span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090187" target="_blank"><span>v</span></a></span><span>)</span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Mag" target="_blank"><span>Mag</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090186" target="_blank"><span>a</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090185" target="_blank"><span>b</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089838" target="_blank"><span>t</span></a></span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Mag" target="_blank"><span>Mag</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090186" target="_blank"><span>a</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090185" target="_blank"><span>b</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089837" target="_blank"><span>u</span></a></span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Mag" target="_blank"><span>Mag</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090186" target="_blank"><span>a</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090185" target="_blank"><span>b</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090187" target="_blank"><span>v</span></a></span></span></span></span></span></span><span>
#endif
</span><span>  </span><span id="m_5071564298494191785gmail-local-6989586621679090255"><span id="m_5071564298494191785gmail-local-6989586621679090256"><span id="m_5071564298494191785gmail-One"><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#One" target="_blank"><span>One</span></a></span></span><span> </span><span>::</span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090256" target="_blank"><span>a</span></a></span><span> </span><span>-></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Mag" target="_blank"><span>Mag</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090256" target="_blank"><span>a</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090255" target="_blank"><span>b</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679090255" target="_blank"><span>b</span></a></span></span></span><span>
</span><span id="m_5071564298494191785gmail-line-217"></span><span>
</span><span id="m_5071564298494191785gmail-line-218"></span><span id="m_5071564298494191785gmail-local-6989586621679089835"><span id="m_5071564298494191785gmail-local-6989586621679089836"><span>instance</span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089832"><span><span>Functor</span></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Mag" target="_blank"><span>Mag</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089836" target="_blank"><span>a</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089835" target="_blank"><span>b</span></a></span><span>)</span></span><span> </span><span>where</span><span>
</span><span id="m_5071564298494191785gmail-line-219"></span><span>  </span><span id="m_5071564298494191785gmail-local-6989586621679089830"><span><span>fmap</span></span></span><span> </span><span>=</span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Map" target="_blank"><span>Map</span></a></span></span></span><span>
</span><span id="m_5071564298494191785gmail-line-220"></span><span>
</span><span id="m_5071564298494191785gmail-line-221"></span><span id="m_5071564298494191785gmail-local-6989586621679089828"><span id="m_5071564298494191785gmail-local-6989586621679089829"><span>instance</span><span> </span><span id="m_5071564298494191785gmail-local-6989586621679089820"><span id="m_5071564298494191785gmail-local-6989586621679089822"><span><span>Applicative</span></span><span> </span><span>(</span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Mag" target="_blank"><span>Mag</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089829" target="_blank"><span>a</span></a></span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#local-6989586621679089828" target="_blank"><span>b</span></a></span><span>)</span></span></span><span> </span><span>where</span><span>
</span><span id="m_5071564298494191785gmail-line-222"></span><span>  </span><span id="m_5071564298494191785gmail-local-6989586621679089818"><span><span>pure</span></span></span><span> </span><span>=</span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Pure" target="_blank"><span>Pure</span></a></span><span>
</span><span id="m_5071564298494191785gmail-line-223"></span><span>  </span><span id="m_5071564298494191785gmail-local-6989586621679089817"><span><span>(<*>)</span></span></span><span> </span><span>=</span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#Ap" target="_blank"><span>Ap</span></a></span><span>
#if MIN_VERSION_base(4,10,0)
</span><span>  </span><span id="m_5071564298494191785gmail-local-6989586621679089816"><span><span>liftA2</span></span></span><span> </span><span>=</span><span> </span><span><a href="https://hackage.haskell.org/package/bifunctors-5.5.9/docs/src/Data.Biapplicative.html#LiftA2" target="_blank"><span>LiftA2</span></a></span></span></span><span>
#endif
</span><span></span></span></span></span></pre><pre><span><span><br><br></span><span></span></span></pre></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jan 3, 2021 at 11:09 AM David Feuer <<a href="mailto:david.feuer@gmail.com" target="_blank">david.feuer@gmail.com</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"><div dir="auto">You're not being very imaginative at all. Try out, oh, `StateT s Maybe`. Or play around with a nice fake functor like the magma used to implement `traverseBia` in `bifunctors`—pretty sure that won't work out.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jan 3, 2021, 11:00 AM Carter Schonwald <<a href="mailto:carter.schonwald@gmail.com" target="_blank">carter.schonwald@gmail.com</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"><div dir="ltr"><div>Hey everyone!</div><div><br></div><div>for context, I have some code where I was seeing how far coerce lets me go to avoid doing wrappers for certain codes,</div><div><br></div><div>i found i had to write the following (mapping an operation over to its newtyped sibling)<br></div><div><br></div><div>```</div><div>-- > :t QRA.wither</div><div>--- forall a b f . Applicative f => (a -> f (Maybe b)) -> RAList a -> f (RAList b)</div><div>---<br></div><div>wither :: forall a b f . (Applicative f, (forall c d .  Coercible c d => Coercible (f c) (f d))  ) =><br>        (a -> f (Maybe b)) -> RAList a -> f (RAList b)<br>wither = \f la ->    coerce     $ QRA.wither f $ coerce la</div><div>```</div><div><br></div><div>i'd much rather be able to write <br></div><div>```</div><div>wither :: forall a b f . (Applicative f) =><br>        (a -> f (Maybe b)) -> RAList a -> f (RAList b)<br>wither = \f la ->    coerce     $ QRA.wither f $ coerce la</div><div>```<br></div><div><br></div><div><br></div><div>this seems like it'd be best done via something like changing the functor class definition to <br></div><div><br></div><div>```<br></div><div>class  (forall c d .  Coercible c d => Coercible (f c) (f d))  ) => Functor f where ..<br></div><div>```</div><div><br></div><div>is there any specific reason why this is not feasible? I cant think of a GADT where this wouldn't be totally safe to do (because unlike in foldable, f is in both the domain and co-domain), but maybe i'm not being imaginative enough?</div><div><br></div><div>look forward to learning what our obstacles are to making this happen for ghc 9.2 :) <br></div><div><br></div><div>-Carter<br></div><div><br></div></div>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" rel="noreferrer" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote></div>
</blockquote></div>