Skip to content

Instantly share code, notes, and snippets.

@gsg
Created August 10, 2015 17:45
Show Gist options
  • Save gsg/a58d7b1c02d3477de605 to your computer and use it in GitHub Desktop.
Save gsg/a58d7b1c02d3477de605 to your computer and use it in GitHub Desktop.
type literal
type param
type _ t =
| QueryString : string -> literal t
| IntParam : string -> param t
| StringParam : string -> param t
type query =
| Nil : query
| Cons : 'a t * query -> query
let to_string : type a . a t -> string = function
| QueryString s -> s
| IntParam s -> ":" ^ s
| StringParam s -> ":" ^ s
let rec query_to_string = function
| Nil -> ""
| Cons (t, rest) -> to_string t ^ query_to_string rest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment