
Hi, I'm writing the following Hspec + QuickCheck test for some type: context "Type1" $ it "decode inverses encode" $ property $ \x -> (decode . encode) x == Right (x::Type1) However, I have a number of these types, and I could write the same test for every type, but that isn't very DRY. Therefore I would like to put the test in a function and call that function for every type. Something like the following: typeTest name = do context name $ it "decode inverses encode" $ property $ \x -> (decode . encode) x == Right x Unfortunately this doesn't work, since QuickCheck doesn't know which Arbitrary instance to use. How can I pass the type, e.g. x::Type1, to this function so QuickCheck knows what Arbitrary instance to use? Kind regards, Martijn Rijkeboer