Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active January 31, 2017 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deque-blog/e9e2e38f7bd7692542d0b12e3975cd32 to your computer and use it in GitHub Desktop.
Save deque-blog/e9e2e38f7bd7692542d0b12e3975cd32 to your computer and use it in GitHub Desktop.
-- 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