title: Modelling algebraic data types using relational database
body: <p>Say you are writing an app in OCaml/F#/SML/Haskell and want to persist data in a relational database. It is easy to map product types (records and tuples) to relations, but how do you map variant types to relations?</p>
  
  <p>To be concrete, how would you persist a type like the following, in a relational database?</p>
  
  <pre><code>(* OCaml *)
  type t = 
    | Foo
    | Bar of string
    | Baz of int * int * int
  </code></pre>