Hacker News new | ask | show | jobs
by titzer 3625 days ago
Use an enum.
1 comments

No need to stop there. Not only use an enum, but also make it bear different types of values for different cases, and you arrive at Algebraic Datatypes. Eg, for trees you can have:

    data Tree = Empty
              | Leaf Int
              | Node Tree Tree