Created
April 17, 2014 22:07
-
-
Save Chandler/11014298 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
type PrintSomething = (String) => String | |
val printer1: PrintSomething = (s: String) => { | |
print("\nI love " + s) | |
s | |
} | |
val printer2: PrintSomething = (s: String) => { | |
print("\nI hate " + s) | |
s | |
} | |
val multiPrinter = printer1.compose(printer2) | |
printer1("cats") | |
// I love cats | |
printer2("cats") | |
// I hate cats | |
multiPrinter("cats") | |
// I love cats | |
// I hate cats |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment