[Haskell-cafe] Convert Either to Tree - Occurs check
André Batista Martins
andre_bm at netcabo.pt
Fri Oct 22 04:23:10 EDT 2010
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 <dpiponi at gmail.com> escreveu:
> 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 writing down the precise type signature you expect it to have.
>
> In fact, before that, try writing down the precise type signature of
> the thing you call an "Either".
> --
> Dan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20101022/8647dd3b/attachment.html
More information about the Haskell-Cafe
mailing list