diff --git a/examples/Test.hs b/examples/Test.hs
--- a/examples/Test.hs
+++ b/examples/Test.hs
@@ -9,6 +9,7 @@
 import Generics.Regular.Functions
 import qualified Generics.Regular.Functions.Show as G
 import qualified Generics.Regular.Functions.Read as G
+import Generics.Regular.Functions.Eq
 
 
 -- Datatype representing logical expressions
diff --git a/regular.cabal b/regular.cabal
--- a/regular.cabal
+++ b/regular.cabal
@@ -1,5 +1,5 @@
 name:                   regular
-version:                0.2.1
+version:                0.2.2
 synopsis:               Generic programming library for regular datatypes.
 description:
 
@@ -34,6 +34,9 @@
                         ChangeLog
                         CREDITS
 
+flag th24
+  description:          Indicates that Template Haskell 2.4 or greater is available.
+
 library
   hs-source-dirs:       src
   exposed-modules:      Generics.Regular
@@ -54,5 +57,10 @@
                         Generics.Regular.Functions.Show
                         Generics.Regular.Functions.Zip
                         
-  build-depends:        base >= 4.0 && < 5, template-haskell >= 2.2 && < 2.4
+  build-depends:        base >= 4.0 && < 5
+  if flag(th24)
+    build-depends:      template-haskell >=2.4 && <2.5
+    cpp-options:          -DTH_TYVARBNDR
+  else
+    build-depends:      template-haskell >= 2.2 && < 2.4
   ghc-options:          -Wall
diff --git a/src/Generics/Regular/Functions/Read.hs b/src/Generics/Regular/Functions/Read.hs
--- a/src/Generics/Regular/Functions/Read.hs
+++ b/src/Generics/Regular/Functions/Read.hs
@@ -36,8 +36,6 @@
 import Text.Read hiding (readsPrec, readPrec, read, Read)
 import Prelude hiding (readsPrec, read, Read)
 import qualified Prelude as P (readsPrec, Read)
-import Text.Read.Lex
-import Text.ParserCombinators.ReadPrec
 
 -- * Count the number of terms in a product
 
diff --git a/src/Generics/Regular/TH.hs b/src/Generics/Regular/TH.hs
--- a/src/Generics/Regular/TH.hs
+++ b/src/Generics/Regular/TH.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE TemplateHaskell, CPP #-}
 {-# OPTIONS_GHC -w           #-}
 
 -----------------------------------------------------------------------------
@@ -80,7 +80,7 @@
 deriveInst t =
   do
     i <- reify t
-    let typ = foldl (\a -> AppT a . VarT) (ConT t) (typeVariables i)
+    let typ = foldl (\a -> AppT a . VarT . tyVarBndrToName) (ConT t) (typeVariables i)
     fcs <- mkFrom t 1 0 t
     tcs <- mkTo   t 1 0 t
     liftM (:[]) $
@@ -115,11 +115,24 @@
       is <- mapM (mkSelectInstance n) cs
       return $ concat (ds ++ is)
 
+#ifdef TH_TYVARBNDR
+typeVariables :: Info -> [TyVarBndr]
+#else
 typeVariables :: Info -> [Name]
+#endif
 typeVariables (TyConI (DataD    _ _ tv _ _)) = tv
 typeVariables (TyConI (NewtypeD _ _ tv _ _)) = tv
 typeVariables _                           = []
 
+#ifdef TH_TYVARBNDR
+tyVarBndrToName :: TyVarBndr -> Name
+tyVarBndrToName (PlainTV  name)   = name
+tyVarBndrToName (KindedTV name _) = name
+#else
+tyVarBndrToName :: Name -> Name
+tyVarBndrToName = id
+#endif
+
 stripRecordNames :: Con -> Con
 stripRecordNames (RecC n f) =
   NormalC n (map (\(_, s, t) -> (s, t)) f)
@@ -189,9 +202,9 @@
       i <- reify n
       let b = case i of
                 TyConI (DataD _ dt vs cs _) ->
-                  foldr1 sum (map (pfCon (dt, vs)) cs)
+                  foldr1 sum (map (pfCon (dt, map tyVarBndrToName vs)) cs)
                 TyConI (NewtypeD _ dt vs c _) ->
-                  pfCon (dt, vs) c
+                  pfCon (dt, map tyVarBndrToName vs) c
                 TyConI (TySynD t _ _) ->
                   conT ''K `appT` conT t
                 _ -> error "unknown construct" 
@@ -240,9 +253,9 @@
       i <- reify n
       let b = case i of
                 TyConI (DataD _ dt vs cs _) ->
-                  zipWith (fromCon wrapE ns (dt, vs) (length cs)) [0..] cs
+                  zipWith (fromCon wrapE ns (dt, map tyVarBndrToName vs) (length cs)) [0..] cs
                 TyConI (NewtypeD _ dt vs c _) ->
-                  [fromCon wrapE ns (dt, vs) 1 0 c]
+                  [fromCon wrapE ns (dt, map tyVarBndrToName vs) 1 0 c]
                 TyConI (TySynD t _ _) ->
                   [clause [varP (field 0)] (normalB (wrapE $ conE 'K `appE` varE (field 0))) []]
                 _ -> error "unknown construct"
@@ -256,9 +269,9 @@
       i <- reify n
       let b = case i of
                 TyConI (DataD _ dt vs cs _) ->
-                  zipWith (toCon wrapP ns (dt, vs) (length cs)) [0..] cs
+                  zipWith (toCon wrapP ns (dt, map tyVarBndrToName vs) (length cs)) [0..] cs
                 TyConI (NewtypeD _ dt vs c _) ->
-                  [toCon wrapP ns (dt, vs) 1 0 c]
+                  [toCon wrapP ns (dt, map tyVarBndrToName vs) 1 0 c]
                 TyConI (TySynD t _ _) ->
                   [clause [wrapP $ conP 'K [varP (field 0)]] (normalB $ varE (field 0)) []]
                 _ -> error "unknown construct" 
