[Haskell-cafe] Re: [Haskell] ANN: quickcheck-poly - Automating QuickCheck for polymorphic/overloaded properties in a small world of types

Henning Thielemann lemming at henning-thielemann.de
Sat Oct 24 17:53:07 EDT 2009

Ahn, Ki Yung schrieb:
> Often times QuickCheck properties are polymophic/overloaded without
> giving a monomorphic type signature.  But there can be several types
> that you are interested.  You can write scripts that check all the types
> you are interested annotating the generic property for each different
> monotype, which is a tedious work to do.  Here, I automated this via
> hint (a Haskell Interpreter Library).  How it works is it first asks a
> type of a property to the Haskell interpreter and gets a type string,
> identifies type variables that start with lowercase alphabet, generate
> all possible substitution that may or may not be a correct type, stick
> the type string to the property name as a signature and collect only the
> meaningful types, and then finally run quickCheck over each meaningful
> types.  The example below clearly illustrates what it does.

Maybe you could write a block of quickCheck tests, that shall be run on
different types.

tests :: a -> IO ()
tests x =
   do quickCheck (\y -> law1 (y `asTypeOf x))

allTests =
   tests (undefined :: Int)
   tests (undefined :: Double)

More information about the Haskell-Cafe mailing list