Last active
January 31, 2017 19:51
-
-
Save deque-blog/e9e2e38f7bd7692542d0b12e3975cd32 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
-- Property is trivially convertible to Property | |
instance Testable Property where | |
property = id | |
-- Result is convertible to Property by creating | |
-- a generator that always return this same result | |
instance Testable Result where | |
property r = Property (Gen (const r)) | |
-- Bool can be converted to Result | |
-- Result can be converted to a Property | |
-- By composition we get that Bool is convertible to Property | |
instance Testable Bool where | |
property = property . toResult where | |
toResult b = if b then Success | |
else Failure { seed = 0, counterExample = []} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment