Skip to content

Instantly share code, notes, and snippets.

@FintanH
Created January 26, 2018 15:41
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 FintanH/6281655b7958af10d020c2f7e20ff5da to your computer and use it in GitHub Desktop.
Save FintanH/6281655b7958af10d020c2f7e20ff5da to your computer and use it in GitHub Desktop.
{-# 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