Is there a way to realize a function of type ((a -> b) -> b) -> Either a b? : <p>Propositions <code>(P -&gt; Q) -&gt; Q</code> and <code>P \/ Q</code> are equivalent.</p>

<p>Is there a way to witness this equivalence in Haskell:</p>

<pre><code>from :: Either a b -&gt; ((a -&gt; b) -&gt; b)
from x = case x of
         Left a -&gt; \f -&gt; f a
         Right b -&gt; \f -&gt; b

to :: ((a -&gt; b) -&gt; b) -&gt; Either a b
to = ???
</code></pre>

<p>such that</p>

<p><code>from . to = id</code> and <code>to . from = id</code>?</p>
