diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,30 @@
+Copyright (c) 2016, Kei Hibino
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+
+    * Neither the name of Kei Hibino nor the names of other
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/src/Language/Haskell/TH/Compat/Data.hs b/src/Language/Haskell/TH/Compat/Data.hs
new file mode 100644
--- /dev/null
+++ b/src/Language/Haskell/TH/Compat/Data.hs
@@ -0,0 +1,26 @@
+{-# LANGUAGE CPP #-}
+
+-- |
+-- Module      : Language.Haskell.TH.Compat.Data
+-- Copyright   : 2016 Kei Hibino
+-- License     : BSD3
+--
+-- Maintainer  : ex8k.hibino@gmail.com
+-- Stability   : experimental
+-- Portability : unknown
+--
+-- This module provides compatibility definitions of
+-- data-type declaration templates for before temaplate-haskell-2.11
+module Language.Haskell.TH.Compat.Data (
+  -- * Interfaces to construct data declarations
+  dataD', newtypeD', dataInstD', newtypeInstD',
+
+  -- * Interfaces to destruct data declarations
+  unDataD, unNewtypeD, unDataInstD, unNewtypeInstD,
+  ) where
+
+#if MIN_VERSION_template_haskell(2,11,0)
+import Language.Haskell.TH.Compat.Data.Current
+#else
+import Language.Haskell.TH.Compat.Data.V210
+#endif
diff --git a/src/Language/Haskell/TH/Compat/Data/Current.hs b/src/Language/Haskell/TH/Compat/Data/Current.hs
new file mode 100644
--- /dev/null
+++ b/src/Language/Haskell/TH/Compat/Data/Current.hs
@@ -0,0 +1,57 @@
+module Language.Haskell.TH.Compat.Data.Current (
+  dataD', unDataD,
+  newtypeD', unNewtypeD,
+  dataInstD', unDataInstD,
+  newtypeInstD', unNewtypeInstD,
+  ) where
+
+import Language.Haskell.TH
+  (CxtQ, ConQ, TypeQ, DecQ,
+   Cxt, Con, Type, Name, TyVarBndr, Kind,
+   Dec (DataD, NewtypeD, DataInstD, NewtypeInstD),
+   dataD, newtypeD, dataInstD, newtypeInstD, conT)
+
+
+-- | Definition against 'dataD',
+--   compatible with before temaplate-haskell-2.11
+dataD' :: CxtQ -> Name -> [TyVarBndr] -> [ConQ] -> [Name]
+       -> DecQ
+dataD' cxt n bs cs ds = dataD cxt n bs Nothing cs $ mapM conT ds
+
+-- | Compatible interface to destruct DataD
+unDataD :: Dec -> Maybe (Cxt, Name, [TyVarBndr], Maybe Kind, [Con], [Type])
+unDataD (DataD cxt n bs mk cs ds) = Just (cxt, n, bs, mk, cs, ds)
+unDataD  _                        = Nothing
+
+-- | Definition against 'newtypeD',
+--   compatible with before temaplate-haskell-2.11
+newtypeD' :: CxtQ -> Name -> [TyVarBndr] -> ConQ -> [Name]
+          -> DecQ
+newtypeD' cxt n bs c ds = newtypeD cxt n bs Nothing c $ mapM conT ds
+
+-- | Compatible interface to destruct NewtypeD
+unNewtypeD :: Dec -> Maybe (Cxt, Name, [TyVarBndr], Maybe Kind, Con, [Type])
+unNewtypeD (NewtypeD cxt n bs mk c ds) = Just (cxt, n, bs, mk, c, ds)
+unNewtypeD  _                          = Nothing
+
+-- | Definition against 'dataInstD',
+--   compatible with before temaplate-haskell-2.11
+dataInstD' :: CxtQ -> Name -> [TypeQ] -> [ConQ] -> [Name]
+           -> DecQ
+dataInstD' cxt n as cs ds = dataInstD cxt n as Nothing cs $ mapM conT ds
+
+-- | Compatible interface to destruct DataInstD
+unDataInstD :: Dec -> Maybe (Cxt, Name, [Type], Maybe Kind, [Con], [Type])
+unDataInstD (DataInstD cxt n as mk cs ds) = Just (cxt, n, as, mk, cs, ds)
+unDataInstD  _                            = Nothing
+
+-- | Definition against 'newtypeInstD',
+--   compatible with before temaplate-haskell-2.11
+newtypeInstD' :: CxtQ -> Name -> [TypeQ] -> ConQ -> [Name]
+              -> DecQ
+newtypeInstD' cxt n as c ds = newtypeInstD cxt n as Nothing c $ mapM conT ds
+
+-- | Compatible interface to destruct NewtypeInstD
+unNewtypeInstD :: Dec -> Maybe (Cxt, Name, [Type], Maybe Kind, Con, [Type])
+unNewtypeInstD (NewtypeInstD cxt n as mk c ds) = Just (cxt, n, as, mk, c, ds)
+unNewtypeInstD  _                              = Nothing
diff --git a/src/Language/Haskell/TH/Compat/Data/V210.hs b/src/Language/Haskell/TH/Compat/Data/V210.hs
new file mode 100644
--- /dev/null
+++ b/src/Language/Haskell/TH/Compat/Data/V210.hs
@@ -0,0 +1,57 @@
+module Language.Haskell.TH.Compat.Data.V210 (
+  dataD', unDataD,
+  newtypeD', unNewtypeD,
+  dataInstD', unDataInstD,
+  newtypeInstD', unNewtypeInstD,
+  ) where
+
+import Language.Haskell.TH
+  (CxtQ, ConQ, TypeQ, DecQ,
+   Cxt, Con, Type (ConT), Name, TyVarBndr, Kind,
+   Dec (DataD, NewtypeD, DataInstD, NewtypeInstD),
+   dataD, newtypeD, dataInstD, newtypeInstD)
+
+
+-- | Definition against 'dataD',
+--   compatible with before temaplate-haskell-2.11
+dataD' :: CxtQ -> Name -> [TyVarBndr] -> [ConQ] -> [Name]
+       -> DecQ
+dataD' = dataD
+
+-- | Compatible interface to destruct DataD
+unDataD :: Dec -> Maybe (Cxt, Name, [TyVarBndr], Maybe Kind, [Con], [Type])
+unDataD (DataD cxt n bs cs ds) = Just (cxt, n, bs, Nothing, cs, map ConT ds)
+unDataD  _                     = Nothing
+
+-- | Definition against 'newtypeD',
+--   compatible with before temaplate-haskell-2.11
+newtypeD' :: CxtQ -> Name -> [TyVarBndr] -> ConQ -> [Name]
+          -> DecQ
+newtypeD' = newtypeD
+
+-- | Compatible interface to destruct NewtypeD
+unNewtypeD :: Dec -> Maybe (Cxt, Name, [TyVarBndr], Maybe Kind, Con, [Type])
+unNewtypeD (NewtypeD cxt n bs c ds) = Just (cxt, n, bs, Nothing, c, map ConT ds)
+unNewtypeD  _                       = Nothing
+
+-- | Definition against 'dataInstD',
+--   compatible with before temaplate-haskell-2.11
+dataInstD' :: CxtQ -> Name -> [TypeQ] -> [ConQ] -> [Name]
+           -> DecQ
+dataInstD' = dataInstD
+
+-- | Compatible interface to destruct DataInstD
+unDataInstD :: Dec -> Maybe (Cxt, Name, [Type], Maybe Kind, [Con], [Type])
+unDataInstD (DataInstD cxt n as cs ds) = Just (cxt, n, as, Nothing, cs, map ConT ds)
+unDataInstD  _                         = Nothing
+
+-- | Definition against 'newtypeInstD',
+--   compatible with before temaplate-haskell-2.11
+newtypeInstD' :: CxtQ -> Name -> [TypeQ] -> ConQ -> [Name]
+              -> DecQ
+newtypeInstD' = newtypeInstD
+
+-- | Compatible interface to destruct NewtypeInstD
+unNewtypeInstD :: Dec -> Maybe (Cxt, Name, [Type], Maybe Kind, Con, [Type])
+unNewtypeInstD (NewtypeInstD cxt n as c ds) = Just (cxt, n, as, Nothing, c, map ConT ds)
+unNewtypeInstD  _                           = Nothing
diff --git a/th-data-compat.cabal b/th-data-compat.cabal
new file mode 100644
--- /dev/null
+++ b/th-data-compat.cabal
@@ -0,0 +1,46 @@
+
+name:                th-data-compat
+version:             0.0.1.0
+synopsis:            Compatibility for data definition template of TH
+description:         This package contains wrapped name definitions of
+                     data definition template
+license:             BSD3
+license-file:        LICENSE
+author:              Kei Hibino
+maintainer:          ex8k.hibino@gmail.com
+copyright:           Copyright (c) 2016 Kei Hibino
+category:            Language
+build-type:          Simple
+-- extra-source-files:
+cabal-version:       >=1.10
+
+flag template-haskell-210
+  description: If true, use template-haskell 2.10 or older, otherwise use template-haskell 2.11 or newer.
+  default:     True
+
+library
+  exposed-modules:      Language.Haskell.TH.Compat.Data
+
+  if flag(template-haskell-210)
+    other-modules:
+                          Language.Haskell.TH.Compat.Data.V210
+    build-depends:        template-haskell >=2.4 && <2.11
+  else
+    other-modules:
+                          Language.Haskell.TH.Compat.Data.Current
+    build-depends:        template-haskell >=2.11
+
+  build-depends:         base <5
+
+  other-extensions:    CPP
+  hs-source-dirs:      src
+  default-language:    Haskell2010
+  ghc-options:         -Wall
+
+source-repository head
+  type:       git
+  location:   https://github.com/khibino/haskell-th-data-compat
+
+source-repository head
+  type:       mercurial
+  location:   https://bitbucket.org/khibino/haskell-th-data-compat
