diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2014, Nikita Volkov
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
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/executables/InternalTests.hs b/executables/InternalTests.hs
new file mode 100644
--- /dev/null
+++ b/executables/InternalTests.hs
@@ -0,0 +1,14 @@
+{-# OPTIONS_GHC -F -pgmF htfpp #-}
+
+import Test.Framework
+import NumericQQ.Prelude
+import NumericQQ
+
+main = htfMain $ htf_thisModulesTests
+
+
+test_basic = do
+  assertEqual 3 [bin|11|]
+  assertEqual 521 [bin|1000001001|]
+  assertEqual 3996 [oct|7634|]
+  assertEqual 41535 [hex|a23f|]
diff --git a/library/NumericQQ.hs b/library/NumericQQ.hs
new file mode 100644
--- /dev/null
+++ b/library/NumericQQ.hs
@@ -0,0 +1,43 @@
+module NumericQQ
+(
+  bin,
+  oct,
+  hex
+)
+where
+
+import NumericQQ.Prelude
+import Numeric
+import Data.Char
+import Language.Haskell.TH
+import Language.Haskell.TH.Quote
+
+
+type Base = Int
+
+bin :: QuasiQuoter
+bin = qq 2
+
+oct :: QuasiQuoter
+oct = qq 8
+
+hex :: QuasiQuoter
+hex = qq 16
+
+qq :: Base -> QuasiQuoter
+qq base = QuasiQuoter {quoteExp = exp} where
+  exp s = 
+    case parse base s of
+      Nothing -> fail $ "A string \"" <> s <> 
+                        "\" cannot be parsed as a base-" <> 
+                        show base <> " number"
+      Just i -> return $ LitE (IntegerL (fromIntegral i))
+
+parse :: Base -> String -> Maybe Int
+parse base string = 
+  case readInt base ((< base) . digitToInt) digitToInt string of
+    [] -> Nothing
+    [(r, "")] -> Just r
+    [(_, _)] -> Nothing
+    r -> $bug $ "Unexpected parsing result: " <> show r
+
diff --git a/library/NumericQQ/Prelude.hs b/library/NumericQQ/Prelude.hs
new file mode 100644
--- /dev/null
+++ b/library/NumericQQ/Prelude.hs
@@ -0,0 +1,63 @@
+module NumericQQ.Prelude
+( 
+  module Exports,
+  bug,
+  bottom,
+)
+where
+
+-- base
+-------------------------
+import Prelude as Exports hiding (concat, foldr, mapM_, sequence_, foldl1, maximum, minimum, product, sum, all, and, any, concatMap, elem, foldl, foldr1, notElem, or, mapM, sequence, FilePath, id, (.))
+import Control.Monad as Exports hiding (mapM_, sequence_, forM_, msum, mapM, sequence, forM)
+import Control.Applicative as Exports
+import Control.Arrow as Exports hiding (left, right)
+import Control.Category as Exports
+import Data.Monoid as Exports
+import Data.Foldable as Exports
+import Data.Traversable as Exports hiding (for)
+import Data.Maybe as Exports
+import Data.Either as Exports
+import Data.List as Exports hiding (concat, foldr, foldl1, maximum, minimum, product, sum, all, and, any, concatMap, elem, foldl, foldr1, notElem, or, find, maximumBy, minimumBy, mapAccumL, mapAccumR, foldl')
+import Data.Tuple as Exports
+import Data.Function as Exports hiding ((.), id)
+import Data.Ord as Exports (Down(..))
+import Data.String as Exports
+import Data.Int as Exports
+import Data.Word as Exports
+import Data.Ratio as Exports
+import Data.Bits as Exports
+import Data.Fixed as Exports
+import Data.Ix as Exports
+import Data.Data as Exports
+import Text.Read as Exports (readMaybe, readEither)
+import Control.Exception as Exports hiding (tryJust, try, assert)
+import System.Mem as Exports
+import System.Mem.StableName as Exports
+import System.Timeout as Exports
+import System.Exit as Exports
+import System.IO.Unsafe as Exports
+import System.IO as Exports (Handle, hClose)
+import System.IO.Error as Exports
+import Unsafe.Coerce as Exports
+import GHC.Conc as Exports
+import GHC.Generics as Exports (Generic)
+import GHC.IO.Exception as Exports
+import Data.IORef as Exports
+import Data.STRef as Exports
+import Control.Monad.ST as Exports
+import Debug.Trace as Exports hiding (traceM)
+
+-- placeholders
+-------------------------
+import Development.Placeholders as Exports
+
+-- custom
+-------------------------
+import qualified Debug.Trace.LocationTH
+
+bug = [e| $(Debug.Trace.LocationTH.failure) . (msg <>) |]
+  where
+    msg = "A \"numeric-qq\" package bug: " :: String
+
+bottom = [e| $bug "Bottom evaluated" |]
diff --git a/numeric-qq.cabal b/numeric-qq.cabal
new file mode 100644
--- /dev/null
+++ b/numeric-qq.cabal
@@ -0,0 +1,81 @@
+name:
+  numeric-qq
+version:
+  0.1.0
+synopsis:
+  Quasi-quoters for numbers of different bases
+description:
+  Quasi-quoters for numbers of different bases
+category:
+  QuasiQoutes, Numeric
+homepage:
+  https://github.com/nikita-volkov/numeric-qq 
+bug-reports:
+  https://github.com/nikita-volkov/numeric-qq/issues 
+author:
+  Nikita Volkov <nikita.y.volkov@mail.ru>
+maintainer:
+  Nikita Volkov <nikita.y.volkov@mail.ru>
+copyright:
+  (c) 2014, Nikita Volkov
+license:
+  MIT
+license-file:
+  LICENSE
+build-type:
+  Simple
+cabal-version:
+  >=1.10
+
+
+source-repository head
+  type:
+    git
+  location:
+    git://github.com/nikita-volkov/numeric-qq.git
+
+
+library
+  hs-source-dirs:
+    library
+  other-modules:
+    NumericQQ.Prelude
+  exposed-modules:
+    NumericQQ
+  build-depends:
+    -- template-haskell:
+    template-haskell == 2.*,
+    -- debugging:
+    loch-th == 0.2.*,
+    placeholders == 0.1.*,
+    -- general:
+    base >= 4.5 && < 5
+  default-extensions:
+    Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFunctor, DeriveGeneric, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, ImpredicativeTypes, LambdaCase, LiberalTypeSynonyms, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators
+  default-language:
+    Haskell2010
+
+
+test-suite internal-tests
+  type:
+    exitcode-stdio-1.0
+  hs-source-dirs:
+    executables
+    library
+  main-is:
+    InternalTests.hs
+  ghc-options:
+    -threaded
+  build-depends:
+    HTF == 0.11.*,
+    -- template-haskell:
+    template-haskell == 2.*,
+    -- debugging:
+    loch-th == 0.2.*,
+    placeholders == 0.1.*,
+    -- general:
+    base >= 4.5 && < 5
+  default-extensions:
+    Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFunctor, DeriveGeneric, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, ImpredicativeTypes, LambdaCase, LiberalTypeSynonyms, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators
+  default-language:
+    Haskell2010
