Skip to content

Instantly share code, notes, and snippets.

@btipling
Created December 26, 2015 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save btipling/40aed3dd0207656cfe42 to your computer and use it in GitHub Desktop.
Save btipling/40aed3dd0207656cfe42 to your computer and use it in GitHub Desktop.
fn main() {
fn map<F, T, A>(option: Option<T>, f: F) -> Option<A> where F: FnOnce(T) -> A {
match option {
None => None,
Some(value) => Some(f(value)),
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment