diff --git a/charset.cabal b/charset.cabal
--- a/charset.cabal
+++ b/charset.cabal
@@ -1,5 +1,5 @@
 name:          charset
-version:       0.3.6
+version:       0.3.7
 license:       BSD3
 license-File:  LICENSE
 copyright:     (c) Edward Kmett 2010-2012
@@ -18,10 +18,6 @@
 source-repository head
   type: git
   location: git://github.com/ekmett/charset.git
-
-flag OldTypeable
-  manual: False
-  default: False
 
 library
   extensions: CPP
diff --git a/src/Data/CharSet.hs b/src/Data/CharSet.hs
--- a/src/Data/CharSet.hs
+++ b/src/Data/CharSet.hs
@@ -3,6 +3,10 @@
 #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702
 {-# LANGUAGE Trustworthy #-}
 #endif
+#if MIN_VERSION_base(4,7,0)
+{-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE StandaloneDeriving #-}
+#endif
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Data.CharSet
@@ -275,6 +279,9 @@
 numChars = oh - ol + 1
 {-# INLINE numChars #-}
 
+#if MIN_VERSION_base(4,7,0)
+deriving instance Typeable CharSet
+#else
 instance Typeable CharSet where
   typeOf _ = mkTyConApp charSetTyCon []
 
@@ -285,6 +292,7 @@
 charSetTyCon = mkTyCon "Data.CharSet.CharSet"
 #endif
 {-# NOINLINE charSetTyCon #-}
+#endif
 
 instance Data CharSet where
   gfoldl k z set
diff --git a/src/Data/CharSet/Common.hs b/src/Data/CharSet/Common.hs
--- a/src/Data/CharSet/Common.hs
+++ b/src/Data/CharSet/Common.hs
@@ -11,7 +11,7 @@
 -------------------------------------------------------------------------------
 
 module Data.CharSet.Common
-    ( 
+    (
     -- ** Data.Char classes
       control
     , space
@@ -39,8 +39,8 @@
 import Data.CharSet
 
 -- Haskell character classes from Data.Char
-control, space, lower, upper, alpha, alphaNum, 
-  print, digit, octDigit, letter, mark, number, 
+control, space, lower, upper, alpha, alphaNum,
+  print, digit, octDigit, letter, mark, number,
   punctuation, symbol, separator, ascii, latin1
   , asciiUpper, asciiLower :: CharSet
 
diff --git a/src/Data/CharSet/Unicode/Category.hs b/src/Data/CharSet/Unicode/Category.hs
--- a/src/Data/CharSet/Unicode/Category.hs
+++ b/src/Data/CharSet/Unicode/Category.hs
@@ -8,16 +8,16 @@
 -- Stability   :  experimental
 -- Portability :  DeriveDataTypeable
 --
--- Provides unicode general categories, which are typically connoted by 
+-- Provides unicode general categories, which are typically connoted by
 -- @\p{Ll}@ or @\p{Modifier_Letter}@. Lookups can be constructed using 'categories'
 -- or individual character sets can be used directly.
--- 
+--
 -- A case, @_@ and @-@ insensitive lookup is provided by 'lookupCategory'
 -- and can be used to provide behavior similar to that of Perl or PCRE.
 -------------------------------------------------------------------------------
 
 module Data.CharSet.Unicode.Category
-    ( 
+    (
     -- * Unicode General Category
       Category(..)
     -- * Lookup
@@ -39,7 +39,7 @@
     , decimalNumber, letterNumber, otherNumber, number
     -- ** Punctuation
     , dashPunctuation, openPunctuation, closePunctuation, initialQuote
-    , finalQuote, connectorPunctuation, otherPunctuation, punctuation 
+    , finalQuote, connectorPunctuation, otherPunctuation, punctuation
     -- ** Other
     , control, format, privateUse, surrogate, notAssigned, other
     ) where
@@ -100,10 +100,10 @@
     ,     Category "Unassigned" "Cn" notAssigned "any code point to which no character has been assigned.properties" ]
 
 lookupTable :: HashMap String Category
-lookupTable = HashMap.fromList 
-  [ (canonicalize x, category) 
+lookupTable = HashMap.fromList
+  [ (canonicalize x, category)
   | category@(Category l s _ _) <- categories
-  , x <- [l,s] 
+  , x <- [l,s]
   ]
 
 lookupCategory :: String -> Maybe Category
@@ -131,14 +131,14 @@
 lowercaseLetter = cat LowercaseLetter
 uppercaseLetter = cat UppercaseLetter
 titlecaseLetter = cat TitlecaseLetter
-letterAnd = lowercaseLetter 
-    `union` uppercaseLetter 
+letterAnd = lowercaseLetter
+    `union` uppercaseLetter
     `union` titlecaseLetter
 modifierLetter  = cat ModifierLetter
 otherLetter = cat OtherLetter
-letter 
-          = letterAnd 
-    `union` modifierLetter 
+letter
+          = letterAnd
+    `union` modifierLetter
     `union` otherLetter
 
 -- Marks
@@ -146,18 +146,18 @@
 nonSpacingMark = cat NonSpacingMark
 spacingCombiningMark = cat SpacingCombiningMark
 enclosingMark = cat EnclosingMark
-mark 
-          = nonSpacingMark 
-    `union` spacingCombiningMark 
+mark
+          = nonSpacingMark
+    `union` spacingCombiningMark
     `union` enclosingMark
 
 space, lineSeparator, paragraphSeparator, separator :: CharSet
 space = cat Space
 lineSeparator = cat LineSeparator
 paragraphSeparator = cat ParagraphSeparator
-separator 
-          = space 
-    `union` lineSeparator 
+separator
+          = space
+    `union` lineSeparator
     `union` paragraphSeparator
 
 mathSymbol, currencySymbol, modifierSymbol, otherSymbol, symbol :: CharSet
@@ -165,22 +165,22 @@
 currencySymbol = cat CurrencySymbol
 modifierSymbol = cat ModifierSymbol
 otherSymbol = cat OtherSymbol
-symbol 
-          = mathSymbol 
-    `union` currencySymbol 
-    `union` modifierSymbol 
+symbol
+          = mathSymbol
+    `union` currencySymbol
+    `union` modifierSymbol
     `union` otherSymbol
 
 decimalNumber, letterNumber, otherNumber, number :: CharSet
 decimalNumber = cat DecimalNumber
 letterNumber = cat LetterNumber
 otherNumber = cat OtherNumber
-number 
-          = decimalNumber 
-    `union` letterNumber 
+number
+          = decimalNumber
+    `union` letterNumber
     `union` otherNumber
 
-dashPunctuation, openPunctuation, closePunctuation, initialQuote, 
+dashPunctuation, openPunctuation, closePunctuation, initialQuote,
   finalQuote, connectorPunctuation, otherPunctuation, punctuation :: CharSet
 
 dashPunctuation = cat DashPunctuation
@@ -190,13 +190,13 @@
 finalQuote = cat FinalQuote
 connectorPunctuation  = cat ConnectorPunctuation
 otherPunctuation = cat OtherPunctuation
-punctuation 
-          = dashPunctuation 
-    `union` openPunctuation 
-    `union` closePunctuation 
-    `union` initialQuote 
-    `union` finalQuote 
-    `union` connectorPunctuation 
+punctuation
+          = dashPunctuation
+    `union` openPunctuation
+    `union` closePunctuation
+    `union` initialQuote
+    `union` finalQuote
+    `union` connectorPunctuation
     `union` otherPunctuation
 
 control, format, privateUse, surrogate, notAssigned, other :: CharSet
@@ -205,8 +205,8 @@
 privateUse = cat PrivateUse
 surrogate = cat Surrogate
 notAssigned = cat NotAssigned
-other = control 
-    `union` format 
-    `union` privateUse 
-    `union` surrogate 
+other = control
+    `union` format
+    `union` privateUse
+    `union` surrogate
     `union` notAssigned
