Tks for the answser,<br>I need to continue a work that has already been developed. In this work i have  Eithers and i want convert  to another datatype with more information, because I want to generate  Eithers, which will contain the information from the first but with positions exchanged.<br>
<br><div class="gmail_quote">No dia 22 de Outubro de 2010 11:30, Neil Brown <span dir="ltr">&lt;<a href="mailto:nccb2@kent.ac.uk">nccb2@kent.ac.uk</a>&gt;</span> escreveu:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">



  

<div text="#000000" bgcolor="#ffffff"><div class="im">
On 22/10/10 09:23, André Batista Martins wrote:
<blockquote type="cite">Tks for the answer,<br>
the data structure of Either is:<br>
   <br>
  <pre><a name="12bd37d8c162b4f1_(line50)"></a><a name="12bd37d8c162b4f1_Either"></a><span>data</span>  <span>Either</span> <span>a</span> <span>b</span>  <span>=</span>  <span>Left</span> <span>a</span> <span>|</span> <span>Right</span> <span>b</span>   <span>deriving</span> <span>(</span><span>Eq</span><span>,</span> <span>Ord</span><span>,</span> <span>Read</span><span>,</span> <span>Show</span><span>)


one example of what i want convert is:
 Left(Right(Left(Left())))</span>
  </pre>
</blockquote></div>
Hi,<br>
<br>
The problem here is that the type of Left () is:<br>
<br>
&gt; Either () a<br>
<br>
The type of Left (Left ()) is:<br>
<br>
&gt; Either (Either () a) b<br>
<br>
The type of Right (Left (Left ())) is:<br>
<br>
&gt; Either c (Either (Either () a) b)<br>
<br>
and finally, the type of Left (Right (Left (Left ()))) is:<br>
<br>
&gt; Either (Either c (Either (Either () a) b)) d<br>
<br>
That is, each level in the tree must have a different type.  For this
reason, you can&#39;t sensibly use Either for tree types of varying depth
(a type-class would help, but I doubt it&#39;s what you want).  A sensible
type for a tree is the one you gave in your original post, TreeE.  So
why do you want to encode the tree with Either (not really possible)
and then convert to your TreeE type?  Why not just start out with the
values in your tree type?<br>
<br>
Thanks,<br>
<br>
Neil.<br>
</div>

</blockquote></div><br>