<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    The other day, I accidentally came up with this:<br>
    <br>
    <pre class="sourceCode haskell"><code><span class="ot">{-# LANGUAGE RankNTypes #-}</span>

<span class="kw">type</span> <span class="dt">Either</span> x y <span class="fu">=</span> forall r<span class="fu">.</span> (x -&gt; r) -&gt; (y -&gt; r) -&gt; r

left :: x -&gt; <span class="dt">Either</span> x y
left x f g <span class="fu">=</span> f x

right :: y -&gt; <span class="dt">Either</span> x y
right y f g <span class="fu">=</span> g y

</code></pre>
    This is one example; it seems that just about any algebraic type can
    be encoded this way. I presume that somebody else has thought of
    this before. Does it have a name?<br>
    <br>
  </body>
</html>