Skip to content

Instantly share code, notes, and snippets.

@gsg
Created March 11, 2016 13:10
Show Gist options
  • Save gsg/c94f15485fc5fb7e90bb to your computer and use it in GitHub Desktop.
Save gsg/c94f15485fc5fb7e90bb to your computer and use it in GitHub Desktop.
type poly = Wrap : 'a key * 'a value -> poly
let rec map f = function
| Nil -> Nil
| Cons (k, v, rest) ->
let Wrap (k', v') = f.f k v in
Cons (k', v', map f rest)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment