Last active
August 29, 2015 14:13
-
-
Save everson/66080d49aebd9f45474e to your computer and use it in GitHub Desktop.
scalaz.Tag
This file contains 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._ | |
import Scalaz._ | |
val isThisCool: Boolean @@ CoolStuff = Tag(true) | |
def requiresCoolStuff(in: Boolean @@ CoolStuff) = in | |
// type checks | |
requiresCoolStuff(isThisCool) | |
if(isThisCool) "still act as bool" else "oops" | |
/* | |
<console>:22: error: type mismatch; | |
found : Boolean(true) | |
required: scalaz.@@[Boolean,CoolStuff] | |
(which expands to) Boolean with AnyRef{type Tag = CoolStuff} | |
requiresCoolStuff(true) | |
*/ | |
requiresCoolStuff(true) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment