diff --git a/.ghci b/.ghci
new file mode 100644
--- /dev/null
+++ b/.ghci
@@ -0,0 +1,1 @@
+:set -isrc -idist/build/autogen -optP-include -optPdist/build/autogen/cabal_macros.h
diff --git a/.gitignore b/.gitignore
new file mode 100644
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,15 @@
+dist
+docs
+wiki
+TAGS
+tags
+wip
+.DS_Store
+.*.swp
+.*.swo
+*.o
+*.hi
+*~
+*#
+.cabal-sandbox
+cabal.sandbox.config
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,24 @@
+env:
+ - GHCVER=7.4.2 CABALVER=1.16
+ - GHCVER=7.6.3 CABALVER=1.18
+ - GHCVER=head CABALVER=1.18 
+
+before_install:
+ - sudo add-apt-repository -y ppa:hvr/ghc
+ - sudo apt-get update
+ - sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER hlint
+ - cabal-$CABALVER update
+ - cabal-$CABALVER install happy -j
+ - export PATH=/opt/ghc/$GHCVER/bin:~/.cabal/bin:$PATH
+
+install:
+ - cabal-$CABALVER install --only-dependencies --enable-tests --enable-benchmarks -j
+
+script:
+ - travis/script.sh
+ - hlint src
+
+matrix:
+  allow_failures:
+   - env: GHCVER=head CABALVER=1.18
+  fast_finish: true
diff --git a/.vim.custom b/.vim.custom
new file mode 100644
--- /dev/null
+++ b/.vim.custom
@@ -0,0 +1,31 @@
+" Add the following to your .vimrc to automatically load this on startup
+
+" if filereadable(".vim.custom")
+"     so .vim.custom
+" endif
+
+function StripTrailingWhitespace()
+  let myline=line(".")
+  let mycolumn = col(".")
+  silent %s/  *$//
+  call cursor(myline, mycolumn)
+endfunction
+
+" enable syntax highlighting
+syntax on
+
+" search for the tags file anywhere between here and /
+set tags=TAGS;/
+
+" highlight tabs and trailing spaces
+set listchars=tab:‗‗,trail:‗
+set list
+
+" f2 runs hasktags
+map <F2> :exec ":!hasktags -x -c --ignore src"<CR><CR>
+
+" strip trailing whitespace before saving
+" au BufWritePre *.hs,*.markdown silent! cal StripTrailingWhitespace()
+
+" rebuild hasktags after saving
+au BufWritePost *.hs silent! :exec ":!hasktags -x -c --ignore src"
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,30 @@
+Copyright 2014 Benno Fünfstück
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+2. 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.
+
+3. Neither the name of the author nor the names of his contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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/README.md b/README.md
new file mode 100644
--- /dev/null
+++ b/README.md
@@ -0,0 +1,7 @@
+th-lift-instances
+====================
+
+[![Build Status](https://secure.travis-ci.org/bennofs/th-lift-instances.png?branch=master)](http://travis-ci.org/bennofs/th-lift-instances)
+
+Some more Lift instances for common haskell data types.
+
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,69 @@
+{-# OPTIONS_GHC -Wall #-}
+module Main (main) where
+
+import Data.IORef
+import Data.List ( nub )
+import Data.Version ( showVersion )
+import Distribution.Package ( PackageName(PackageName), PackageId, InstalledPackageId, packageVersion, packageName )
+import Distribution.PackageDescription ( PackageDescription(), TestSuite(..), hsSourceDirs, libBuildInfo, buildInfo)
+import Distribution.Simple ( defaultMainWithHooks, UserHooks(..), simpleUserHooks )
+import Distribution.Simple.BuildPaths ( autogenModulesDir )
+import Distribution.Simple.LocalBuildInfo ( withLibLBI, withTestLBI, withExeLBI, ComponentLocalBuildInfo(), LocalBuildInfo(), componentPackageDeps )
+import Distribution.Simple.Setup ( BuildFlags(buildVerbosity), fromFlag, buildDistPref, defaultDistPref, fromFlagOrDefault )
+import Distribution.Simple.Utils ( rewriteFile, createDirectoryIfMissingVerbose )
+import Distribution.Verbosity ( Verbosity )
+import System.Directory ( canonicalizePath )
+import System.FilePath ( (</>) )
+
+main :: IO ()
+main = defaultMainWithHooks simpleUserHooks
+  { buildHook = \pkg lbi hooks flags -> do
+     generateBuildModule (fromFlag (buildVerbosity flags)) pkg lbi flags
+     buildHook simpleUserHooks pkg lbi hooks flags
+  }
+
+--  Very ad-hoc implementation of difference lists
+singletonDL :: a -> [a] -> [a]
+singletonDL = (:)
+
+emptyDL :: [a] -> [a]
+emptyDL = id
+
+appendDL :: ([a] -> [a]) -> ([a] -> [a]) -> [a] -> [a]
+appendDL x y = x . y
+
+generateBuildModule :: Verbosity -> PackageDescription -> LocalBuildInfo -> BuildFlags -> IO ()
+generateBuildModule verbosity pkg lbi flags = do
+  let dir = autogenModulesDir lbi
+  createDirectoryIfMissingVerbose verbosity True dir
+  withTestLBI pkg lbi $ \suite suitelbi -> do
+    srcDirs <- mapM canonicalizePath $ hsSourceDirs $ testBuildInfo suite
+    distDir <- canonicalizePath $ fromFlagOrDefault defaultDistPref $ buildDistPref flags
+
+    depsVar <- newIORef emptyDL
+    withLibLBI pkg lbi $ \lib liblbi ->
+      modifyIORef depsVar $ appendDL . singletonDL $ depsEntry (libBuildInfo lib) liblbi suitelbi
+    withExeLBI pkg lbi $ \exe exelbi ->
+      modifyIORef depsVar $ appendDL . singletonDL $ depsEntry (buildInfo exe) exelbi suitelbi
+    deps <- fmap ($ []) $ readIORef depsVar
+
+    rewriteFile (map fixchar $ dir </> "Build_" ++ testName suite ++ ".hs") $ unlines 
+      [ "module Build_" ++ map fixchar (testName suite) ++ " where"
+      , "getDistDir :: FilePath"
+      , "getDistDir = " ++ show distDir
+      , "getSrcDirs :: [FilePath]"
+      , "getSrcDirs = " ++ show srcDirs
+      , "deps :: [([FilePath], [String])]"
+      , "deps = " ++ show deps
+      ]
+
+  where
+    formatdeps = map (formatone . snd)
+    formatone p = case packageName p of
+      PackageName n -> n ++ "-" ++ showVersion (packageVersion p)
+    depsEntry targetbi targetlbi suitelbi = (hsSourceDirs targetbi, formatdeps $ testDeps targetlbi suitelbi)
+    fixchar '-' = '_'
+    fixchar c = c
+
+testDeps :: ComponentLocalBuildInfo -> ComponentLocalBuildInfo -> [(InstalledPackageId, PackageId)]
+testDeps xs ys = nub $ componentPackageDeps xs ++ componentPackageDeps ys
diff --git a/src/Instances/TH/Lift.hs b/src/Instances/TH/Lift.hs
new file mode 100644
--- /dev/null
+++ b/src/Instances/TH/Lift.hs
@@ -0,0 +1,134 @@
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-# LANGUAGE TemplateHaskell #-}
+module Instances.TH.Lift 
+  ( -- | This module provides orphan instances for the 'Language.Haskell.TH.Syntax.Lift' class from template-haskell. Following is a list of the provided instances.
+    -- 
+    -- Lift instances are useful to precompute values at compile time using template haskell. For example, if you write the following code,
+    -- you can make sure that @3 * 10@ is really computed at compile time:
+    --
+    -- > {-# LANGUAGE TemplateHaskell #-}
+    -- >
+    -- > import Language.Haskell.TH.Syntax
+    -- >
+    -- > expensiveComputation :: Word32
+    -- > expensiveComputation = $(lift $ 3 * 10) -- This will computed at compile time
+    --
+    -- This uses the Lift instance for Word32.
+
+    -- * Base
+    -- |  * 'Word8', 'Word16', 'Word32', 'Word64'
+    --
+    --    * 'Int8', 'Int16', 'Int32', 'Int64'
+
+    -- * Containers (both strict/lazy)
+    -- |  * 'Data.IntMap.IntMap'
+    -- 
+    --    * 'Data.IntSet.IntSet'
+    --    
+    --    * 'Data.Map.Map'
+    -- 
+    --    * 'Data.Set.Set'
+    --
+    --    * 'Data.Tree.Tree'
+    --
+    --    * 'Data.Sequence.Seq'
+
+    -- * ByteString (both strict/lazy)
+    -- |  * 'Data.ByteString'
+    
+    -- * Text (both strict/lazy)
+    -- |  * 'Data.Text'
+  ) where
+
+import Language.Haskell.TH
+import Language.Haskell.TH.Lift
+
+import qualified Data.Foldable as F
+
+-- Base
+import Data.Int
+import Data.Word
+
+-- Containers
+import qualified Data.IntMap as IntMap
+import qualified Data.IntSet as IntSet
+import qualified Data.Map as Map
+import qualified Data.Sequence as Sequence
+import qualified Data.Set as Set
+import qualified Data.Tree as Tree
+
+-- Text
+import qualified Data.Text as Text
+import qualified Data.Text.Lazy as Text.Lazy
+
+-- ByteString
+import qualified Data.ByteString as ByteString
+import qualified Data.ByteString.Lazy as ByteString.Lazy
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- Base
+instance Lift Word8 where
+  lift x = [| fromInteger $(lift $ toInteger x) :: Word8 |]
+
+instance Lift Word16 where
+  lift x = [| fromInteger $(lift $ toInteger x) :: Word16 |]
+
+instance Lift Word32 where
+  lift x = [| fromInteger $(lift $ toInteger x) :: Word32 |]
+
+instance Lift Word64 where
+  lift x = [| fromInteger $(lift $ toInteger x) :: Word64 |]
+
+instance Lift Int8 where
+  lift x = [| fromInteger $(lift $ toInteger x) :: Int8 |]
+
+instance Lift Int16 where
+  lift x = [| fromInteger $(lift $ toInteger x) :: Int16 |]
+
+instance Lift Int32 where
+  lift x = [| fromInteger $(lift $ toInteger x) :: Int32 |]
+
+instance Lift Int64 where
+  lift x = [| fromInteger $(lift $ toInteger x) :: Int64 |]
+
+instance Lift Float where
+  lift x = [| $(litE $ rationalL $ toRational x) :: Float |]
+
+instance Lift Double where
+  lift x = [| $(litE $ rationalL $ toRational x) :: Double |]
+
+--------------------------------------------------------------------------------
+-- Containers
+instance Lift v => Lift (IntMap.IntMap v) where
+  lift m = [| IntMap.fromList $(lift $ IntMap.toList m) |]
+
+instance Lift IntSet.IntSet where
+  lift s = [| IntSet.fromList $(lift $ IntSet.toList s) |] 
+
+instance (Lift k, Lift v) => Lift (Map.Map k v) where
+  lift m = [| Map.fromList $(lift $ Map.toList m) |]
+
+instance Lift a => Lift (Sequence.Seq a) where
+  lift s = [| Sequence.fromList $(lift $ F.toList s) |]
+
+instance Lift a => Lift (Set.Set a) where
+  lift s = [| Set.fromList $(lift $ Set.toList s) |]
+
+deriveLift ''Tree.Tree
+
+--------------------------------------------------------------------------------
+-- Text
+instance Lift Text.Text where
+  lift t = [| Text.pack $(lift $ Text.unpack t) |]
+
+instance Lift Text.Lazy.Text where
+  lift t = [| Text.Lazy.pack $(lift $ Text.Lazy.unpack t) |]
+
+--------------------------------------------------------------------------------
+-- ByteString
+instance Lift ByteString.ByteString where
+  lift b = [| ByteString.pack $(lift $ ByteString.unpack b) |]
+
+instance Lift ByteString.Lazy.ByteString where
+  lift b = [| ByteString.Lazy.pack $(lift $ ByteString.Lazy.unpack b) |]
diff --git a/tests/Main.hs b/tests/Main.hs
new file mode 100644
--- /dev/null
+++ b/tests/Main.hs
@@ -0,0 +1,105 @@
+{-# LANGUAGE TemplateHaskell #-}
+module Main where
+
+import Data
+
+import Control.Monad
+import Data.Int
+import Data.Word
+import Instances.TH.Lift()
+import Language.Haskell.TH.Syntax
+import System.Exit
+import Test.QuickCheck.All
+
+import qualified Data.IntMap as IntMap
+import qualified Data.IntMap.Strict as IntMap.Strict
+import qualified Data.IntSet as IntSet
+import qualified Data.Map as Map
+import qualified Data.Map.Strict as Map.Strict
+import qualified Data.Sequence as Sequence
+import qualified Data.Set as Set
+
+import qualified Data.Text as Text
+import qualified Data.Text.Lazy as Text.Lazy
+
+import qualified Data.ByteString as ByteString
+import qualified Data.ByteString.Lazy as ByteString.Lazy
+
+--------------------------------------------------------------------------------
+-- Base
+prop_word8 :: Bool
+prop_word8 = $(lift (10 :: Word8)) == (10 :: Word8)
+
+prop_word16 :: Bool
+prop_word16 = $(lift (10 :: Word16)) == (10 :: Word16)
+
+prop_word32 :: Bool
+prop_word32 = $(lift (10 :: Word32)) == (10 :: Word32)
+
+prop_word64 :: Bool
+prop_word64 = $(lift (10 :: Word64)) == (10 :: Word64)
+
+prop_int8 :: Bool
+prop_int8 = $(lift (10 :: Int8)) == (10 :: Int8)
+
+prop_int16 :: Bool
+prop_int16 = $(lift (10 :: Int16)) == (10 :: Int16)
+
+prop_int32 :: Bool
+prop_int32 = $(lift (10 :: Int32)) == (10 :: Int32)
+
+prop_int64 :: Bool
+prop_int64 = $(lift (10 :: Int64)) == (10 :: Int64)
+
+prop_float :: Bool
+prop_float = $(lift (1.1 :: Float)) == (1.1 :: Float)
+
+prop_double :: Bool
+prop_double = $(lift (1.1 :: Double)) == (1.1 :: Double)
+
+--------------------------------------------------------------------------------
+-- Containers
+prop_lazy_int_map :: Bool
+prop_lazy_int_map = $(lift $ IntMap.fromList mapdata) == IntMap.fromList mapdata
+
+prop_strict_int_map :: Bool
+prop_strict_int_map = $(lift $ IntMap.Strict.fromList mapdata) == IntMap.Strict.fromList mapdata
+
+prop_lazy_map :: Bool
+prop_lazy_map = $(lift $ Map.fromList mapdata) == Map.fromList mapdata
+
+prop_strict_map :: Bool
+prop_strict_map = $(lift $ Map.Strict.fromList mapdata) == Map.Strict.fromList mapdata
+
+prop_int_set :: Bool
+prop_int_set = $(lift $ IntSet.fromList setdata) == IntSet.fromList setdata
+
+prop_set :: Bool
+prop_set = $(lift $ Set.fromList setdata) == Set.fromList setdata
+
+prop_tree :: Bool
+prop_tree = $(lift treedata) == treedata
+
+prop_sequence :: Bool
+prop_sequence = $(lift $ Sequence.fromList setdata) == Sequence.fromList setdata
+
+--------------------------------------------------------------------------------
+-- Text
+prop_text :: Bool
+prop_text = $(lift $ Text.pack textdata) == Text.pack textdata
+
+prop_lazy_text :: Bool
+prop_lazy_text = $(lift $ Text.Lazy.pack textdata) == Text.Lazy.pack textdata
+
+--------------------------------------------------------------------------------
+-- ByteString
+prop_bytestring :: Bool
+prop_bytestring = $(lift $ ByteString.pack bytedata) == ByteString.pack bytedata
+
+prop_lazy_bytestring :: Bool
+prop_lazy_bytestring = $(lift $ ByteString.Lazy.pack bytedata) == ByteString.Lazy.pack bytedata
+
+main :: IO ()
+main = do 
+  success <- $quickCheckAll
+  unless success exitFailure
diff --git a/tests/doctests.hsc b/tests/doctests.hsc
new file mode 100644
--- /dev/null
+++ b/tests/doctests.hsc
@@ -0,0 +1,74 @@
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+-----------------------------------------------------------------------------
+-- Copyright   :  (C) 2012-13 Edward Kmett
+-- License     :  BSD-style (see the file LICENSE)
+-- Maintainer  :  Edward Kmett <ekmett@gmail.com>
+-- Stability   :  provisional
+-- Portability :  portable
+--
+-- This module provides doctests for a project based on the actual versions
+-- of the packages it was built with. It requires a corresponding Setup.lhs
+-- to be added to the project
+-----------------------------------------------------------------------------
+module Main where
+
+import Build_doctests (deps)
+import Control.Applicative
+import Control.Monad
+import Data.List
+import System.Directory
+import System.FilePath
+import Test.DocTest
+
+##ifdef mingw32_HOST_ARCH
+##ifdef i386_HOST_ARCH
+##define USE_CP
+import Control.Applicative
+import Control.Exception
+import Foreign.C.Types
+foreign import stdcall "windows.h SetConsoleCP" c_SetConsoleCP :: CUInt -> IO Bool
+foreign import stdcall "windows.h GetConsoleCP" c_GetConsoleCP :: IO CUInt
+##elif defined(x86_64_HOST_ARCH)
+##define USE_CP
+import Control.Applicative
+import Control.Exception
+import Foreign.C.Types
+foreign import ccall "windows.h SetConsoleCP" c_SetConsoleCP :: CUInt -> IO Bool
+foreign import ccall "windows.h GetConsoleCP" c_GetConsoleCP :: IO CUInt
+##endif
+##endif
+
+-- | Run in a modified codepage where we can print UTF-8 values on Windows.
+withUnicode :: IO a -> IO a
+##ifdef USE_CP
+withUnicode m = do
+  cp <- c_GetConsoleCP
+  (c_SetConsoleCP 65001 >> m) `finally` c_SetConsoleCP cp
+##else
+withUnicode m = m
+##endif
+
+main :: IO ()
+main = withUnicode $ forM_ deps $ \(dirs, dep) -> do
+    putStrLn $ ":: Running doctests for source directories: " ++ intercalate " " dirs
+    mapM getSources dirs >>= \sources -> doctest $
+        "-idist/build/autogen"
+      : "-optP-include"
+      : "-optPdist/build/autogen/cabal_macros.h"
+      : "-hide-all-packages"
+      : map ("-package="++) dep
+        ++ map ("-i"++) dirs 
+        ++ join sources 
+
+getSources :: FilePath -> IO [FilePath]
+getSources d = filter (isSuffixOf ".hs") <$> go d
+  where
+    go dir = do
+      (dirs, files) <- getFilesAndDirectories dir
+      (files ++) . concat <$> mapM go dirs
+
+getFilesAndDirectories :: FilePath -> IO ([FilePath], [FilePath])
+getFilesAndDirectories dir = do
+  c <- map (dir </>) . filter (`notElem` ["..", "."]) <$> getDirectoryContents dir
+  (,) <$> filterM doesDirectoryExist c <*> filterM doesFileExist c
diff --git a/th-lift-instances.cabal b/th-lift-instances.cabal
new file mode 100644
--- /dev/null
+++ b/th-lift-instances.cabal
@@ -0,0 +1,71 @@
+name:          th-lift-instances
+version:       0.1
+license:       BSD3
+cabal-version: >= 1.10
+license-file:  LICENSE
+author:        Benno Fünfstück
+maintainer:    Benno Fünfstück <benno.fuenfstueck@gmail.com>
+stability:     experimental
+homepage:      http://github.com/bennofs/th-lift-instances/
+bug-reports:   http://github.com/bennofs/th-lift-instances/issues
+copyright:     Copyright (C) 2013 Benno Fünfstück
+synopsis:      Lift instances for template-hasell for common data types.
+description:   Most data types in haskell platform do not have Lift instances. This package provides orphan instances
+	       for containers, text and bytestring.
+build-type:    Custom
+category:      Template Haskell
+
+extra-source-files:
+  .ghci
+  .gitignore
+  .travis.yml
+  .vim.custom
+  README.md
+
+source-repository head
+  type: git
+  location: https://github.com/bennofs/th-lift-instances.git
+
+library
+  hs-source-dirs: src
+  default-language: Haskell2010
+  ghc-options: -Wall -fwarn-tabs
+  build-depends:
+      base >= 4.4 && < 5
+    , template-haskell
+    , th-lift
+    , containers == 0.5.*
+    , vector == 0.10.*
+    , text == 1.1.*
+    , bytestring == 0.10.*
+  exposed-modules:
+    Instances.TH.Lift
+
+test-suite tests
+  type:    exitcode-stdio-1.0
+  main-is: Main.hs
+  default-language: Haskell2010
+  build-depends:
+      base
+    , template-haskell
+    , containers == 0.5.*
+    , vector == 0.10.*
+    , text == 1.1.*
+    , bytestring == 0.10.*
+    , th-lift-instances
+    , QuickCheck >= 2.6 && < 2.8
+  hs-source-dirs: tests
+
+test-suite doctests
+  type:    exitcode-stdio-1.0
+  main-is: doctests.hs
+  default-language: Haskell2010
+  build-depends:
+      base
+    , directory >= 1.0
+    , doctest >= 0.9.1
+    , filepath
+  ghc-options: -Wall -threaded
+  if impl(ghc<7.6.1)
+    ghc-options: -Werror
+  hs-source-dirs: tests
