diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,30 @@
+Copyright Author name here (c) 2016
+
+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 Author name here 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/show-prettyprint.cabal b/show-prettyprint.cabal
new file mode 100644
--- /dev/null
+++ b/show-prettyprint.cabal
@@ -0,0 +1,36 @@
+name:                show-prettyprint
+version:             0.1.0.0
+synopsis:            Robust prettyprinter for output of auto-generated Show
+                     instances
+description:         See README.md
+homepage:            https://github.com/quchen/show-prettyprint#readme
+license:             BSD3
+license-file:        LICENSE
+author:              David Luposchainsky <dluposchainsky (λ) google>
+maintainer:          David Luposchainsky <dluposchainsky (λ) google>
+copyright:           David Luposchainsky, 2016
+category:            User Interfaces, Text
+build-type:          Simple
+-- extra-source-files:
+cabal-version:       >=1.10
+
+library
+  hs-source-dirs:      src
+  exposed-modules:     Text.Show.Prettyprint
+  build-depends:       base >= 4.7 && < 5
+                     , trifecta >= 1.6
+                     , wl-pprint >= 1.1
+  default-language:    Haskell2010
+
+test-suite doctest
+  type:                exitcode-stdio-1.0
+  hs-source-dirs:      test/Doctest
+  main-is:             Main.hs
+  build-depends:       base
+                     , doctest >= 0.9
+  ghc-options:         -Wall -threaded -rtsopts -with-rtsopts=-N
+  default-language:    Haskell2010
+
+source-repository head
+  type:     git
+  location: https://github.com/quchen/show-prettyprint
diff --git a/src/Text/Show/Prettyprint.hs b/src/Text/Show/Prettyprint.hs
new file mode 100644
--- /dev/null
+++ b/src/Text/Show/Prettyprint.hs
@@ -0,0 +1,117 @@
+{-# LANGUAGE LambdaCase        #-}
+{-# LANGUAGE OverloadedStrings #-}
+
+-- | Format a 'show'-generated string to make it nicer to read.
+--
+-- >>> :{
+-- (putStrLn . prettyShow . Data.Map.fromList)
+--     [("hello", Just True), ("world", Nothing), ("!", Just False)]
+-- :}
+-- fromList [("!",Just False)
+--          ,("hello",Just True)
+--          ,("world",Nothing)]
+--
+-- See the readme for some more examples.
+module Text.Show.Prettyprint (
+    prettifyShow,
+    prettyShow,
+
+    -- * Diagnostic functions
+    prettifyShowErr,
+    prettyShowErr,
+) where
+
+
+
+import Control.Applicative
+import Data.Monoid
+import Text.PrettyPrint.Leijen as Ppr hiding ((<>))
+import Text.Trifecta           as Tri
+
+
+
+-- | Prettyprint a string produced by 'show'. On parse error, silently fall back
+-- to a non-prettyprinted version.
+prettifyShow :: String -> String
+prettifyShow s = case parseString conP mempty s of
+    Success x -> show x
+    Failure _ -> s
+
+-- | 'prettifyShow' with the 'show' baked in.
+prettyShow :: Show a => a -> String
+prettyShow = prettifyShow . show
+
+-- | Attempt to prettify a string produced by 'show'. Report error information
+-- on failure.
+prettifyShowErr :: String -> String
+prettifyShowErr s = case parseString conP mempty s of
+    Success x -> show x
+    Failure ErrInfo{ _errDoc = e } -> "ERROR " <> show e
+
+-- | 'prettifyShowErr' with the 'show' baked in.
+prettyShowErr :: Show a => a -> String
+prettyShowErr = prettifyShowErr . show
+
+
+
+conP :: Parser Doc
+conP = do
+    thing <- (token . choice)
+        [ word
+        , number
+        , fmap (dquotes . Ppr.string) stringLiteral ]
+    args <- many argP
+    pure (if null args
+        then thing
+        else thing <+> align (sep args) )
+
+word :: Parser Doc
+word = variable <|> constructor
+
+number :: Parser Doc
+number = p <?> "number"
+  where
+    p = integerOrDouble >>= \case
+        Left i -> pure (Ppr.integer i)
+        Right d -> pure (Ppr.double d)
+
+identifierStartingWith :: CharParsing f => f Char -> f Doc
+identifierStartingWith x = liftA2 (\c cs -> Ppr.string (c:cs)) (x <|> Tri.char '_') (many (alphaNum <|> oneOf "'_"))
+
+variable :: Parser Doc
+variable = identifierStartingWith lower <?> "variable"
+
+constructor :: Parser Doc
+constructor = identifierStartingWith upper <?> "constructor"
+
+argP :: Parser Doc
+argP = (token . choice) [unitP, tupleP, listP, recordP, conP]
+
+unitP :: Parser Doc
+unitP = p <?> "()"
+  where
+    p = fmap Ppr.string (Tri.string "()")
+
+tupleP :: Parser Doc
+tupleP = p <?> "tuple"
+  where
+    p = fmap (encloseSep lparen rparen Ppr.comma) (Tri.parens (do
+        x <- argP
+        xs <- many (Tri.comma *> argP)
+        pure (x:xs) ))
+
+listP :: Parser Doc
+listP = p <?> "list"
+  where
+    p = fmap (encloseSep lbracket rbracket Ppr.comma)
+             (Tri.brackets (sepBy argP Tri.comma))
+
+recordP :: Parser Doc
+recordP = p <?> "{...}"
+  where
+    p = fmap (encloseSep lbrace rbrace Ppr.comma) (Tri.braces (sepBy recordEntryP Tri.comma))
+    recordEntryP = do
+        lhs <- token word
+        _ <- token (Tri.char '=')
+        rhs <- argP
+        pure (lhs <+> Ppr.string "=" <+> rhs)
diff --git a/test/Doctest/Main.hs b/test/Doctest/Main.hs
new file mode 100644
--- /dev/null
+++ b/test/Doctest/Main.hs
@@ -0,0 +1,6 @@
+module Main (main) where
+
+import Test.DocTest
+
+main :: IO ()
+main = doctest ["src"]
