Created
January 21, 2018 18:11
-
-
Save fommil/eb0c8b83bb4e5b63f7decb9cd68132fb to your computer and use it in GitHub Desktop.
anonymous coproducts
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
import scalaz._ | |
def foo(x: String \/ Int) = { | |
x match { | |
case -\/(s) => println("I'm a String") | |
case \/-(i) => println("I'm an Int") | |
case _ => println("I cannot be anything else 'cuz compiler guarantees it!") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment