Last active
November 4, 2019 18:59
-
-
Save Ciantic/6d1bd5dd2842b71b233f0a6cb9233833 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
newtype Maybe' a = Maybe' {getMaybe' :: Maybe a} | |
deriving Show | |
-- $setup | |
-- >>> :set -XScopedTypeVariables | |
-- >>> :set -XFlexibleContexts | |
-- >>> import Test.QuickCheck | |
-- $ | |
-- | Maybe | |
-- | |
-- transitivity test: | |
-- | |
-- prop> (\x y z -> (Maybe' x == Maybe' y && Maybe' y == Maybe' z) ==> (Maybe' x == Maybe' z)) | |
-- | |
-- above gives me `*** Gave up! Passed only 24 tests; 1000 discarded tests.` | |
-- | |
-- Compared to: | |
-- | |
-- >>> quickCheck (\x y z -> (Maybe' x == Maybe' y && Maybe' y == Maybe' z) ==> (Maybe' x == Maybe' z)) | |
-- | |
-- above gives me `OK, passed 100 tests; 144 discarded.` | |
-- | |
instance Eq a => Eq (Maybe' a) where | |
(Maybe' (Just a)) == (Maybe' (Just a')) = a == a' | |
(Maybe' Nothing ) == (Maybe' Nothing ) = True | |
_ == _ = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment