Skip to content

Instantly share code, notes, and snippets.

@gsg
Last active August 29, 2015 14:17
Show Gist options
  • Save gsg/015f491348f3d7f22bc5 to your computer and use it in GitHub Desktop.
Save gsg/015f491348f3d7f22bc5 to your computer and use it in GitHub Desktop.
(* compile with -rectypes *)
type (_, _) t =
| Nil : ('t, 't) t
| Cons : ('t -> 'a) * ('r, 't) t -> (('a -> 'r), 't) t
(* replace the _ here with b -> no crash *)
let test : type a b . a -> (_, a) t -> unit =
fun value -> function
| Nil -> ()
| Cons (getter, rest) ->
ignore (getter value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment