Created
March 31, 2018 18:51
-
-
Save mrwonko/315f3cf6c6c6357193998cdefc14396f to your computer and use it in GitHub Desktop.
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
type | |
Boolable = concept x | |
if x: discard | |
Bool = concept x | |
x is bool | |
when isMainModule: | |
type MyInt = distinct int | |
converter toBool(x: MyInt): bool = int(x) != 0 | |
doAssert(MyInt is Boolable) | |
doAssert(not (MyInt is Bool)) | |
doAssert(bool is Boolable) | |
doAssert(bool is Bool) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment