Skip to content

Instantly share code, notes, and snippets.

@gsg
Created October 30, 2016 10:28
Show Gist options
  • Save gsg/791fd04c9564f3ea0ca54ab72d7b0210 to your computer and use it in GitHub Desktop.
Save gsg/791fd04c9564f3ea0ca54ab72d7b0210 to your computer and use it in GitHub Desktop.
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