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

Dan Piponi dpiponi at gmail.com
Thu Oct 21 23:58:30 EDT 2010


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


More information about the Haskell-Cafe mailing list