[Haskell-cafe] Convert Either to Tree - Occurs check

2010-10-21 Thread André Batista Martins
hello, i want convert "Either" to a tree. Example: Either ( Either 1 2 ) ( Either 3 4) > Branch ( Branch (Leafl 1) (Leafr2) ) ( Branch (Leafl 3) (Leafr4)) ) Code: data TreeE a b = Empty |Leafl a | Leafr b | Branch (TreeE a b ) (TreeE a b) deriving Show f3 (Righ

Re: [Haskell-cafe] Convert Either to Tree - Occurs check

2010-10-21 Thread Dan Piponi
André Batista Martins asked: >  i want convert  "Either" to a tree. >  Example: >   Either ( Either  1 2 ) ( Either 3 4) > > Branch ( Branch (Leafl 1)  (Leafr2) ) ( Branch (Leafl 3)  (Leafr4)) ) Before writing the function to convert your data structure, why not try writi

Re: [Haskell-cafe] Convert Either to Tree - Occurs check

2010-10-22 Thread André Batista Martins
Tks for the answer, the data structure of Either is: data Either a b = Left a | Right b deriving (Eq, Ord, Read, Show) one example of what i want convert is: Left(Right(Left(Left( No dia 22 de Outubro de 2010 04:58, Dan Piponi escreveu: > André Batista Martins asked: > > > i want

Re: [Haskell-cafe] Convert Either to Tree - Occurs check

2010-10-22 Thread Neil Brown
On 22/10/10 09:23, André Batista Martins wrote: Tks for the answer, the data structure of Either is: data Either a b = Left a | Right bderiving (Eq, Ord, Read, Show) one example of what i want convert is: Left(Right(Left(Left( Hi, The problem here is that the t

Re: [Haskell-cafe] Convert Either to Tree - Occurs check

2010-10-22 Thread André Batista Martins
Tks for the answser, 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. No dia 22