Thanks for the thoughtful discussion of GADTs with both some advantages and challenges. Did you consider having analysts write SQL?
The implementation for `parse_dim` is missing. How do you write that with an existential type? I think the function signature is something like `val parse_dim: string -> 'a dim`, but the following implementation fails to compile because `string` from `Country` conflicts with `bool` from `Logged_in`: --- ocaml let parse_dim = function | "country" -> Country | "logged in" -> Logged_in | s -> failwith (s ^ " is not a valid dimension") ---
I think this was this missing piece: --- ocaml type edim = Edim: 'a dim -> edim let parse_dim: string -> edim = function | "country" -> Edim Country | "logged in" -> Edim Logged_in | s -> failwith (s ^ " is not a valid dimension") ---