Created
March 13, 2020 05:26
-
-
Save surajsau/3aa4d3a8a344d275fd3090335e204674 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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