This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.
Let’s implement a binary tree in Haskell. 1 2 3 data Tree a = Leaf a | Node ( Tree a) ( Tree a) deriving ( Show , Eq ) The above defines a Tree that takes a value of type a . Because we have not explicitly specified any datatype (such as an Int or a [Char] , for instance) and instead defined it in terms of a which can stand for any type, this tree is capable of handling values of any…
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.