Consider the following algebraic data type in Haskell:
1 |
|
What is the type of data strucutre that
X
entails?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
What this definition means is that X is either empty or contains some value of typeclass a and two X 's. This is what exactly a binary tree is!
Here is how someone would use this defintion to represent a tree like this: