Skip to content

Instantly share code, notes, and snippets.

@smondet
Created October 19, 2016 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smondet/a7ad324e185278d9cc9bed4781b99a99 to your computer and use it in GitHub Desktop.
Save smondet/a7ad324e185278d9cc9bed4781b99a99 to your computer and use it in GitHub Desktop.
Transfer existential types
type t =
| Text: 'a list -> t
type u =
| Uext: 'a list -> u
let f: t -> u =
function
| Text l -> Uext l
let l =
function
| Uext l -> List.length l
let () =
Printf.printf "\n\nl: %d\n\n%!"
(l (f (Text [1; 2; 3])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment