Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gsg
Created October 30, 2016 10: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 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