Skip to content

Instantly share code, notes, and snippets.

@gsg
Created Oct 30, 2016
Embed
What would you like to do?
let filter xs =
List.filter (function `G a -> true | _ -> false) xs
let rec refine (xs : [> `G of 'a] list) : [`G of 'a] list =
match xs with
| [] -> []
| ((`G _) as elt)::rest -> elt::refine rest
| _::_ -> assert false
let argtest = [`X(`True);`G(`False)];;
let toto = refine (filter argtest)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment