Skip to content

Instantly share code, notes, and snippets.

@surajsau
Created March 13, 2020 05:26
Show Gist options
  • Save surajsau/3aa4d3a8a344d275fd3090335e204674 to your computer and use it in GitHub Desktop.
Save surajsau/3aa4d3a8a344d275fd3090335e204674 to your computer and use it in GitHub Desktop.
fun add3(x: Int) = x + 3 //our normal function
val something = Functor.Something(3)
val altered = something.map { add3(it) }.map { add3(it) } //returns Something(9)
val nothing = Functor.Nothing
val alteredNothing = nothing.map { add3(it) } //returns Nothing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment