3 ms·
Employee, Person and list are types Worker and Manager are constructors Employee is a Sum Type i.e. it can either take a value of (Worker personObject) or (Man
by scriptdevil 8y ago
Employee, Person and list are types
Worker and Manager are constructors
Employee is a Sum Type i.e. it can either take a value of (Worker personObject) or (Manager [empObj1, empObj2...])
for instance, an binary tree would be
type Tree a =
| Leaf of a
| Node of (Tree a * Tree a)
Now, a Tree Int would be
t = Node (Node (Leaf 1, Leaf 2), Leaf 3)