News for hackers. Stuff that matters.
Re:Why Use F#? by scriptdevil on Wednesday December 12, 2018 @11:46PM (#18669892)
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)

There are no comments on this comment yet.