diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,30 @@
+Copyright (c) 2015, Merijn Verstraaten
+
+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 Merijn Verstraaten 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/ValidLiterals.hs b/ValidLiterals.hs
new file mode 100644
--- /dev/null
+++ b/ValidLiterals.hs
@@ -0,0 +1,36 @@
+{-# LANGUAGE DefaultSignatures #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE TemplateHaskell #-}
+module ValidLiterals where
+
+import Data.Maybe
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+
+class Validate a b where
+    fromLiteral :: a -> Maybe b
+
+    spliceValid :: a -> b -> Q (TExp b)
+    default spliceValid :: Lift b => a -> b -> Q (TExp b)
+    spliceValid _ v = [|| v ||]
+
+valid :: Validate a b => a -> Q (TExp b)
+valid input = case fromLiteral input of
+    Nothing -> fail "Invalid input used for type-safe validated literal!"
+    Just result -> spliceValid input result
+
+validInteger :: Validate Integer b => Integer -> Q (TExp b)
+validInteger = valid
+
+validRational :: Validate Rational b => Rational -> Q (TExp b)
+validRational = valid
+
+validString :: Validate String b => String -> Q (TExp b)
+validString = valid
+
+validList :: Validate [a] b => [a] -> Q (TExp b)
+validList = valid
+
+hackySpliceValid :: (Lift a, Validate a b) => a -> b -> Q (TExp b)
+hackySpliceValid v _ = [|| fromJust (fromLiteral v) ||]
diff --git a/examples/ByteString.hs b/examples/ByteString.hs
new file mode 100644
--- /dev/null
+++ b/examples/ByteString.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+module ByteString (ByteString) where
+
+import Data.ByteString.Char8 (ByteString, pack)
+import Data.Char
+
+import ValidLiterals
+
+instance Validate String ByteString where
+    fromLiteral s
+        | all ((<=255) . ord) s = Just $ pack s
+        | otherwise = Nothing
+
+    spliceValid = hackySpliceValid
diff --git a/examples/Even.hs b/examples/Even.hs
new file mode 100644
--- /dev/null
+++ b/examples/Even.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE TemplateHaskell #-}
+module Even where
+
+import ValidLiterals
+
+newtype Even = Even Integer
+
+instance Integral a => Validate a Even where
+    fromLiteral i
+        | even i = Just . Even $ fromIntegral i
+        | otherwise = Nothing
+
+    spliceValid _ (Even i) = [|| Even i ||]
diff --git a/examples/Examples.hs b/examples/Examples.hs
new file mode 100644
--- /dev/null
+++ b/examples/Examples.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE TemplateHaskell #-}
+module Examples where
+
+import ValidLiterals
+import Even
+import ByteString
+
+x :: Even
+x = $$(validInteger 38)
+
+b :: ByteString
+b = $$(valid "HTTP/1.1 GET")
diff --git a/validated-literals.cabal b/validated-literals.cabal
new file mode 100644
--- /dev/null
+++ b/validated-literals.cabal
@@ -0,0 +1,49 @@
+Name:                validated-literals
+Version:             0.1.0
+
+Homepage:            https://github.com/merijn/validated-literals
+Bug-Reports:         https://github.com/merijn/validated-literals/issues
+
+Author:              Merijn Verstraaten
+Maintainer:          Merijn Verstraaten <merijn@inconsistent.nl>
+Copyright:           Copyright © 2015 Merijn Verstraaten
+
+License:             BSD3
+License-File:        LICENSE
+
+Category:            Data
+Cabal-Version:       >= 1.10
+Build-Type:          Simple
+Tested-With:         GHC == 7.8.3
+
+Synopsis:            Compile-time checking for partial smart-constructors
+
+Description:
+
+Extra-Source-Files:
+    examples/ByteString.hs
+    examples/Even.hs
+    examples/Examples.hs
+
+Library
+  Default-Language:     Haskell2010
+  GHC-Options:          -Wall
+
+  Default-Extensions:   
+  Other-Extensions:     DefaultSignatures, FlexibleContexts,
+                        MultiParamTypeClasses, TemplateHaskell
+
+  Exposed-Modules:      ValidLiterals
+  Other-Modules:        
+
+  Build-Depends:        base >=4.8 && <4.9
+               ,        template-haskell
+               ,        bytestring >=0.10 && <0.11
+
+Source-Repository head
+  Type:     mercurial
+  Location: https://bitbucket.org/merijnv/validated-literals
+
+Source-Repository head
+  Type:     git
+  Location: git+ssh://github.com:merijn/validated-literals
