Created
January 26, 2018 15:41
-
-
Save FintanH/6281655b7958af10d020c2f7e20ff5da 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
{-# LANGUAGE FlexibleInstances #-} | |
import Test.QuickCheck | |
import Test.QuickCheck.Checkers | |
import Test.QuickCheck.Classes | |
newtype Flip f a b = Flip (f b a) deriving (Eq, Show) | |
instance (Arbitrary a, Arbitrary b, Arbitrary (f b a)) => Arbitrary (Flip f a b) where | |
arbitrary = do | |
f <- arbitrary | |
return $ Flip f | |
newtype K a b = K a deriving (Eq, Show) | |
instance (Arbitrary a) => Arbitrary (K a b) where | |
arbitrary = do | |
a <- arbitrary | |
return $ K a | |
instance Functor (Flip K a) where | |
fmap f (Flip (K a)) = Flip (K (f a)) | |
instance (Eq (f a b)) => EqProp (Flip f b a) where (=-=) = eq | |
main = do | |
let trigger :: Flip K String (String, String, String) | |
trigger = undefined | |
quickBatch $ functor trigger |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment