diff --git a/Main.hs b/Main.hs
deleted file mode 100644
--- a/Main.hs
+++ /dev/null
@@ -1,31 +0,0 @@
-{-# LANGUAGE TemplateHaskell, QuasiQuotes, FlexibleContexts #-}
-
-module Main (main) where
-
-import Text.Peggy
-
-genParser [] [peggy|
--- Simple Arithmetic Expression Parser
-
-top :: Double = expr
-
-expr :: Double
-  = expr "+" fact { $1 + $2 }
-  / expr "-" fact { $1 - $2 }
-  / fact
-
-fact :: Double
-  = fact "*" term { $1 * $2 }
-  / fact "/" term { $1 / $2 }
-  / term
-
-term :: Double
-  = "(" expr ")"
-  / number
-
-number ::: Double
-  = [1-9] [0-9]* { read ($1 : $2) }
-|]
-
-main :: IO ()
-main = print . parseString top "<stdin>" =<< getContents
diff --git a/Text/Peggy/CodeGen/TH.hs b/Text/Peggy/CodeGen/TH.hs
--- a/Text/Peggy/CodeGen/TH.hs
+++ b/Text/Peggy/CodeGen/TH.hs
@@ -111,6 +111,7 @@
           typ
   
   -- Generate Parser
+  genP :: Bool -> Expr -> ExpQ
   genP isE e = case (isE, e) of
     (False, Terminals False False str) ->
       [| string str |]
@@ -243,9 +244,12 @@
           noBindS (genP isE f) :
           genBinds ix fs
 
+  genRanges :: [CharRange] -> ExpQ
   genRanges rs =
     let c = mkName "c" in
     lamE [varP c] $ foldl1 (\a b -> [| $a || $b |]) $ map (genRange c) rs
+
+  genRange :: Name -> CharRange -> ExpQ
   genRange c (CharRange l h) =
     [| l <= $(varE c) && $(varE c) <= h |]
   genRange c (CharOne v) =
@@ -297,9 +301,11 @@
   case parseType typ of
     Left err -> error $ "type parse error :" ++ typ ++ ", " ++ err
     Right t -> case t of
-      -- GHC.Unit.() is not a type name. Is it a bug of haskell-src-meta?
+      -- GHC.Unit.()/GHC.Tuple.() is not a type name. Is it a bug of haskell-src-meta?
       -- Use (TupleT 0) insted.
       ConT con | show con == "GHC.Unit.()" ->
+        return $ TupleT 0
+      ConT con | show con == "GHC.Tuple.()" ->
         return $ TupleT 0
       _ ->
         return t
diff --git a/example/Main.hs b/example/Main.hs
new file mode 100644
--- /dev/null
+++ b/example/Main.hs
@@ -0,0 +1,31 @@
+{-# LANGUAGE TemplateHaskell, QuasiQuotes, FlexibleContexts #-}
+
+module Main (main) where
+
+import Text.Peggy
+
+genParser [] [peggy|
+-- Simple Arithmetic Expression Parser
+
+top :: Double = expr
+
+expr :: Double
+  = expr "+" fact { $1 + $2 }
+  / expr "-" fact { $1 - $2 }
+  / fact
+
+fact :: Double
+  = fact "*" term { $1 * $2 }
+  / fact "/" term { $1 / $2 }
+  / term
+
+term :: Double
+  = "(" expr ")"
+  / number
+
+number ::: Double
+  = [1-9] [0-9]* { read ($1 : $2) }
+|]
+
+main :: IO ()
+main = print . parseString top "<stdin>" =<< getContents
diff --git a/peggy.cabal b/peggy.cabal
--- a/peggy.cabal
+++ b/peggy.cabal
@@ -1,5 +1,5 @@
 Name:                peggy
-Version:             0.3.0
+Version:             0.3.1
 Synopsis:            The Parser Generator for Haskell
 
 Description:
@@ -16,6 +16,7 @@
 Copyright:           Copyright (c)2011, Hideyuki Tanaka
 Category:            Language
 Build-type:          Simple
+Cabal-version:       >=1.8
 
 Extra-source-files:  README.md
                      bootstrap/README.md
@@ -24,8 +25,13 @@
                      bootstrap/Bootstrap.hs
                      bootstrap/peggy.peggy
 
-Cabal-version:       >=1.8
+flag build-example
+  default:           False
 
+Source-repository head
+  Type:              git
+  Location:          git://github.com/tanakh/Peggy.git
+
 Library
   Exposed-modules:     Text.Peggy
                      , Text.Peggy.CodeGen.TH
@@ -37,27 +43,20 @@
                      , Text.Peggy.SrcLoc
                      , Text.Peggy.Syntax
   
-  Build-depends:       base >= 4 && < 5
-                     , mtl >= 2.0 && < 2.1
-                     , ListLike >= 3.1 && < 3.2
-                     , hashtables >= 1.0 && < 1.1
-                     , monad-control >= 0.2 && < 0.3
-                     , template-haskell >= 2.5 && < 2.7
-                     , haskell-src-meta >= 0.5 && < 0.6
-  
-  -- Other-modules:       
+  Build-depends:       base             == 4.*
+                     , mtl              == 2.0.*
+                     , ListLike         == 3.1.*
+                     , hashtables       == 1.0.*
+                     , monad-control    == 0.3.*
+                     , template-haskell >= 2.5 && < 2.8
+                     , haskell-src-meta == 0.5.*
   
-Executable peggy
+Executable peggy-example
+  Hs-source-dirs:      example
   Main-is:             Main.hs
 
-  Build-depends:       base >= 4 && < 5
-                     , mtl >= 2.0 && < 2.1
-                     , ListLike >= 3.1 && < 3.2
-                     , hashtables >= 1.0 && < 1.1
-                     , monad-control >= 0.2 && < 0.3
-                     , template-haskell >= 2.5 && < 2.7
-                     , haskell-src-meta >= 0.5 && < 0.6
+  Build-depends:       base  == 4.*
+                     , peggy
 
-Source-repository head
-  Type:              git
-  Location:          git://github.com/tanakh/Peggy.git
+  if !flag(build-example)
+    Buildable:         False
