diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,7 @@
+Copyright (c) 2017 Alexander Thiemann
+
+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/README.md b/README.md
new file mode 100644
--- /dev/null
+++ b/README.md
@@ -0,0 +1,5 @@
+# format-numbers
+
+[![CircleCI](https://circleci.com/gh/agrafix/format-numbers.svg?style=svg)](https://circleci.com/gh/agrafix/format-numbers)
+
+Various number formatting functions
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/format-numbers.cabal b/format-numbers.cabal
new file mode 100644
--- /dev/null
+++ b/format-numbers.cabal
@@ -0,0 +1,50 @@
+-- This file has been generated from package.yaml by hpack version 0.15.0.
+--
+-- see: https://github.com/sol/hpack
+
+name:           format-numbers
+version:        0.1.0.0
+synopsis:       Various number formatting functions
+description:    Various number formatting functions
+category:       Web
+homepage:       https://github.com/agrafix/format-numbers#readme
+author:         Alexander Thiemann
+maintainer:     mail@athiemann.net
+copyright:      2017 Alexander Thiemann <mail@athiemann.net>
+license:        MIT
+license-file:   LICENSE
+build-type:     Simple
+cabal-version:  >= 1.10
+
+extra-source-files:
+    package.yaml
+    README.md
+    stack.yaml
+
+library
+  hs-source-dirs:
+      src
+  build-depends:
+      base >= 4.7 && < 5
+    , text
+  exposed-modules:
+      Data.Text.Format.Numbers
+  other-modules:
+      Paths_format_numbers
+  default-language: Haskell2010
+
+test-suite spec
+  type: exitcode-stdio-1.0
+  main-is: Test.hs
+  hs-source-dirs:
+      test
+    , src
+  cpp-options: -DTEST
+  build-depends:
+      base >= 4.7 && < 5
+    , text
+    , hspec
+  other-modules:
+      Data.Text.Format.NumbersSpec
+      Data.Text.Format.Numbers
+  default-language: Haskell2010
diff --git a/package.yaml b/package.yaml
new file mode 100644
--- /dev/null
+++ b/package.yaml
@@ -0,0 +1,33 @@
+name:                format-numbers
+version:             0.1.0.0
+synopsis:            Various number formatting functions
+description:         Various number formatting functions
+homepage:            https://github.com/agrafix/format-numbers#readme
+license:             MIT
+author:              Alexander Thiemann
+maintainer:          mail@athiemann.net
+copyright:           2017 Alexander Thiemann <mail@athiemann.net>
+category:            Web
+extra-source-files:
+  - README.md
+  - package.yaml
+  - stack.yaml
+
+dependencies:
+  - base >= 4.7 && < 5
+  - text
+
+library:
+  source-dirs: src
+  exposed-modules:
+    - Data.Text.Format.Numbers
+
+tests:
+  spec:
+    cpp-options: -DTEST
+    main: Test.hs
+    source-dirs:
+      - test
+      - src
+    dependencies:
+      - hspec
diff --git a/src/Data/Text/Format/Numbers.hs b/src/Data/Text/Format/Numbers.hs
new file mode 100644
--- /dev/null
+++ b/src/Data/Text/Format/Numbers.hs
@@ -0,0 +1,53 @@
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE RecordWildCards #-}
+module Data.Text.Format.Numbers
+    ( PrettyCfg(..)
+    , prettyF
+    , prettyI
+    )
+where
+
+import Data.Monoid
+import qualified Data.Text as T
+
+data PrettyCfg
+    = PrettyCfg
+    { pc_decimals :: !Int
+      -- ^ Decimals to display
+    , pc_thousandsSep :: !(Maybe Char)
+      -- ^ Optional thousands separator
+    , pc_decimalSep :: !Char
+      -- ^ Decimal separator
+    }
+
+-- | Pretty print any number given a configuration
+prettyF :: RealFrac i => PrettyCfg -> i -> T.Text
+prettyF PrettyCfg{..} n =
+  let tpow = 10 ^ pc_decimals
+      lshift = n * fromIntegral tpow
+      lshiftr = round lshift
+      lshifti' = abs lshiftr
+      intPart = lshifti' `div` tpow
+      decPart = lshifti' - intPart * tpow
+      preDecimal =
+          if lshiftr < 0
+          then prettyI pc_thousandsSep (intPart * (-1))
+          else prettyI pc_thousandsSep intPart
+      postDecimal =
+          if pc_decimals > 0
+          then T.cons pc_decimalSep (T.justifyLeft pc_decimals '0' $ T.pack $ show decPart)
+          else ""
+  in preDecimal <> postDecimal
+
+-- | Pretty print an 'Int' given an optional thousands separator
+prettyI :: Maybe Char -> Int -> T.Text
+prettyI tsep n =
+  let ni = T.pack $ show $ abs n
+      nis =
+          case tsep of
+            Just s ->
+                T.intercalate (T.singleton s) $
+                reverse $ map T.reverse $ T.chunksOf 3 $ T.reverse ni
+            Nothing ->
+                ni
+  in if n < 0 then "-" <> nis else nis
diff --git a/stack.yaml b/stack.yaml
new file mode 100644
--- /dev/null
+++ b/stack.yaml
@@ -0,0 +1,3 @@
+resolver: lts-7.15
+packages:
+  - .
diff --git a/test/Data/Text/Format/NumbersSpec.hs b/test/Data/Text/Format/NumbersSpec.hs
new file mode 100644
--- /dev/null
+++ b/test/Data/Text/Format/NumbersSpec.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE OverloadedStrings #-}
+module Data.Text.Format.NumbersSpec (spec) where
+
+import Data.Text.Format.Numbers
+
+import Data.Monoid
+import Test.Hspec
+import qualified Data.Text as T
+
+formatTest :: (Double -> T.Text) -> Double -> T.Text -> SpecWith ()
+formatTest f i o =
+    it ("formats " <> show i <> " correctly as " <> T.unpack o) $
+    f i `shouldBe` o
+
+formatTestI :: (Int -> T.Text) -> Int -> T.Text -> SpecWith ()
+formatTestI f i o =
+    it ("formats " <> show i <> " correctly as " <> T.unpack o) $
+    f i `shouldBe` o
+
+spec :: Spec
+spec =
+    do describe "pretty" $
+           do let p dec t s = prettyF (PrettyCfg dec (Just t) s)
+              formatTest (p 2 ',' '.') 81601710123.338023 "81,601,710,123.34"
+              formatTest (p 3 ' ' '.') 81601710123.338023 "81 601 710 123.338"
+              formatTest (p 2 ' ' '.') (-81601710123.338023) "-81 601 710 123.34"
+              formatTest (p 0 ' ' ',') 12 "12"
+              formatTest (p 0 ' ' ',') 12.1 "12"
+              formatTest (p 1 ' ' ',') 12.1 "12,1"
+              formatTest (p 2 ' ' ',') 12.1 "12,10"
+              formatTest (prettyF $ PrettyCfg 2 Nothing ',') 1200.1 "1200,10"
+       describe "prettyInt" $
+           do formatTestI (prettyI $ Just ',') 81601710123 "81,601,710,123"
+              formatTestI (prettyI $ Just ' ') 81601710123 "81 601 710 123"
+              formatTestI (prettyI $ Just ' ') (-81601710123) "-81 601 710 123"
+              formatTestI (prettyI Nothing) (-81601710123) "-81601710123"
+              formatTestI (prettyI Nothing) 81601710123 "81601710123"
diff --git a/test/Test.hs b/test/Test.hs
new file mode 100644
--- /dev/null
+++ b/test/Test.hs
@@ -0,0 +1,1 @@
+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
