Last active
October 30, 2017 11:54
-
-
Save Abhiroop/44d49bb895ad6aeb34f987ff23caef50 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Nat = Zero | Succ Nat | |
data T n a = NodeR (Tree n a) a (Tree (Succ n) a) -- right subtree has height + 1 | |
| NodeL (Tree (Succ n) a) a (Tree n a) -- left subtree has height + 1 | |
| Node (Tree n a) a (Tree n a) -- both subtrees are of equal height | |
data Tree n a where | |
Branch :: T n a -> Tree (Succ n) a | |
Leaf :: Tree Zero a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment