issuu-blog

Open full view…

Practicalities and trade-offs in programming with GADTs

Sun, 13 Nov 2016 19:11:07 GMT

maxheiber
Sun, 13 Nov 2016 19:11:07 GMT

Thanks for the thoughtful discussion of GADTs with both some advantages and challenges. Did you consider having analysts write SQL?

ddickstein
Sat, 22 Sep 2018 03:29:30 GMT

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") ---

ddickstein
Sat, 22 Sep 2018 04:19:25 GMT

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") ---