Hacker News new | ask | show | jobs
by scriptdevil 2747 days 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)