diff --git a/js-good-parts.cabal b/js-good-parts.cabal
--- a/js-good-parts.cabal
+++ b/js-good-parts.cabal
@@ -1,5 +1,5 @@
 Name:                js-good-parts
-Version:             0.0.2
+Version:             0.0.3
 Cabal-Version:       >= 1.6
 Synopsis:            Javascript: The Good Parts -- AST & Pretty Printer
 Category:            Language, Javascript
@@ -28,3 +28,4 @@
   Exposed-Modules:    Language.JavaScript.AST
                       Language.JavaScript.Pretty
   Other-Modules:      Language.JavaScript.NonEmptyList
+                      Text.PrettyPrint.Leijen.PrettyPrec
diff --git a/src/Text/PrettyPrint/Leijen/PrettyPrec.hs b/src/Text/PrettyPrint/Leijen/PrettyPrec.hs
new file mode 100644
--- /dev/null
+++ b/src/Text/PrettyPrint/Leijen/PrettyPrec.hs
@@ -0,0 +1,65 @@
+{-# OPTIONS_GHC -Wall -fno-warn-orphans #-}
+----------------------------------------------------------------------
+-- |
+-- Module      :  Text.PrettyPrint.Leijen.PrettyPrec
+-- Copyright   :  (c) Conal Elliott 2009
+-- License     :  BSD
+--
+-- Maintainer  :  conal@conal.net
+-- Stability   :  experimental
+--
+-- Pretty class with precedence
+----------------------------------------------------------------------
+
+module Text.PrettyPrint.Leijen.PrettyPrec( 
+  PrettyPrec(..)
+) where
+
+import Data.Ratio (Ratio)
+
+import Text.PrettyPrint.Leijen
+
+-- | Pretty printing with precedence.  A cross between 'Show' and 'Pretty'.
+-- The 'prettyPrec' method defaults to discarding the context precedence
+-- and invoking 'pretty'.  The reason 'PrettyPrec' derives from Pretty is
+-- that so that this default is possible.
+--
+-- To make a 'Show' instance for a 'PrettyPrec' instance 'Foo', define
+--
+--   instance Show Foo where showsPrec p e = showsPrec p (prettyPrec p e)
+
+class Pretty a => PrettyPrec a where
+  prettyPrec :: Int -> a -> Doc
+  prettyPrec = const pretty  -- default
+
+instance PrettyPrec Doc
+instance PrettyPrec ()
+instance PrettyPrec Bool
+instance PrettyPrec Char
+instance PrettyPrec Int
+instance PrettyPrec Integer
+instance PrettyPrec Float
+instance PrettyPrec Double
+
+-- Orphan. Missing from wl-pprint
+instance (Integral a, Show a) => Pretty (Ratio a) where
+  pretty = text . show
+
+instance Pretty a => PrettyPrec [a]
+
+instance (Pretty a,Pretty b) => PrettyPrec (a,b)
+
+instance (Pretty a,Pretty b,Pretty c) => PrettyPrec (a,b,c)
+
+instance PrettyPrec a => PrettyPrec (Maybe a) where
+  prettyPrec p = maybe empty (prettyPrec p)
+
+instance (Integral a, Show a) => PrettyPrec (Ratio a) where
+  prettyPrec = const (text . show)
+
+{--------------------------------------------------------------------
+    'Show' helpers
+--------------------------------------------------------------------}
+
+pageWidth :: Int
+pageWidth = 80
