[Haskell-beginners] Help with a data type declaration

jamb at hinojosa.com jamb at hinojosa.com
Tue Sep 29 14:10:48 UTC 2015


How can I interpret the following data type declaration? The book where 
I am studying (and other sources I have read as well) only show more 
simple examples. This is what I can say about it:

* "Tree" is the name of the new type.
* "Branch" and "Leaf" are the type constructors.
* What is "a" and "b"?
* It seems to me that this type is kind of "recursively" defined but I 
do not know exactly.


data Tree a b = Branch b (Tree a b) (Tree a b)
               | Leaf a

I will very much appreciate your feedback.

Regards,
JAMB


More information about the Beginners mailing list