News for hackers. Stuff that matters.
Re:What Is Null? (2010) by _hardwaregeek on Sunday August 04, 2019 @12:08AM (#20604372)
Which is why variants/discriminated unions are so powerful. A common "hump", if you will, that beginners get over with OCaml is an over reliance on booleans. A beginner will write a function that takes an isOpen argument. A more advanced programmer will model the state as a discriminated union that is either Open or Closed.

Combine that with generics and you can get generic unions like Maybe which allow you to create sets of states that can be composed with any type.

There are no comments on this comment yet.