Skip to content

Instantly share code, notes, and snippets.

@Leonidas-from-XIV
Created February 10, 2017 21:53
Show Gist options
  • Save Leonidas-from-XIV/98efb6bb6fea7c8a8b33cfa55c6f5f4c to your computer and use it in GitHub Desktop.
Save Leonidas-from-XIV/98efb6bb6fea7c8a8b33cfa55c6f5f4c to your computer and use it in GitHub Desktop.
with
module type Mapper = sig
type 'a t
val map : ('a -> 'b) -> 'a t -> 'b t
end
module OptionMapper : Mapper
with type 'a t = 'a option
= struct
type 'a t = 'a option
let map f = function
| Some a -> Some (f a)
| _ -> None
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment