diff --git a/doctest.cabal b/doctest.cabal
--- a/doctest.cabal
+++ b/doctest.cabal
@@ -1,5 +1,5 @@
 name:             doctest
-version:          0.9.10.2
+version:          0.9.11
 synopsis:         Test interactive Haskell examples
 description:      The doctest program checks examples in source code comments.
                   It is modeled after doctest for Python
@@ -92,6 +92,7 @@
     , ghc-paths
     , transformers
 
+    , base-compat   >= 0.4.2
     , HUnit
     , hspec         >= 1.5.1
     , QuickCheck    >= 2.5
diff --git a/src/Property.hs b/src/Property.hs
--- a/src/Property.hs
+++ b/src/Property.hs
@@ -24,8 +24,12 @@
 
 runProperty :: Interpreter -> Expression -> IO PropertyResult
 runProperty repl expression = do
-  _ <- Interpreter.eval repl "import Test.QuickCheck (quickCheck, (==>))"
-  r <- closeTerm expression >>= (Interpreter.safeEval repl . quickCheck)
+  _ <- Interpreter.eval repl "import Test.QuickCheck ((==>))"
+  _ <- Interpreter.eval repl "import Test.QuickCheck.All (polyQuickCheck)"
+  _ <- Interpreter.eval repl "import Language.Haskell.TH (mkName)"
+  _ <- Interpreter.eval repl ":set -XTemplateHaskell"
+  r <- freeVariables repl expression >>=
+       (Interpreter.safeEval repl . quickCheck expression)
   case r of
     Left err -> do
       return (Error err)
@@ -35,16 +39,9 @@
           let msg =  stripEnd (takeWhileEnd (/= '\b') res)
           return (Failure msg)
   where
-    quickCheck term = "quickCheck (" ++ term ++ ")"
-
-    -- | Find all free variables in given term, and close it by abstrating over
-    -- them.
-    closeTerm :: String -> IO String
-    closeTerm term = do
-      r <- freeVariables repl (quickCheck term)
-      case r of
-        []   -> return term
-        vars -> return ("\\" ++ unwords vars ++ "-> (" ++ term ++ ")")
+    quickCheck term vars =
+      "let doctest_prop " ++ unwords vars ++ " = " ++ term ++ "\n" ++
+      "$(polyQuickCheck (mkName \"doctest_prop\"))"
 
 -- | Find all free variables in given term.
 --
@@ -69,6 +66,6 @@
     -- | Remove quotes from given name, if any.
     unquote ('`':xs)     = init xs
 #if __GLASGOW_HASKELL__ >= 707
-    unquote ('\8219':xs) = init xs
+    unquote ('\8216':xs) = init xs
 #endif
     unquote xs           = xs
