diff --git a/OptDir.cabal b/OptDir.cabal
--- a/OptDir.cabal
+++ b/OptDir.cabal
@@ -1,5 +1,5 @@
 Name:           OptDir
-Version:        0.0.2
+Version:        0.0.3
 Cabal-Version:  >= 1.10
 License:        BSD3
 License-file:   LICENSE
@@ -16,9 +16,9 @@
   location: git://github.com/msakai/haskell-optdir.git
 
 Library
-  Build-Depends:      base >=4 && <5, syb, hashable
+  Build-Depends:      base >=4 && <5, syb, hashable >=1.1.2.5
   Hs-Source-Dirs:     src
   Exposed-Modules:    Data.OptDir
   Default-Language:   Haskell2010
-  Other-Extensions:   DeriveDataTypeable
+  Other-Extensions:   DeriveDataTypeable, CPP
   GHC-Options:        -Wall
diff --git a/src/Data/OptDir.hs b/src/Data/OptDir.hs
--- a/src/Data/OptDir.hs
+++ b/src/Data/OptDir.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE DeriveDataTypeable, CPP #-}
 
 -----------------------------------------------------------------------------
 -- |
@@ -8,7 +8,7 @@
 -- 
 -- Maintainer  :  masahiro.sakai@gmail.com
 -- Stability   :  stable
--- Portability :  portable
+-- Portability :  non-portable (DeriveDataTypeable, CPP)
 --
 -- The OptDir type for representing optimization directions.
 --
@@ -33,3 +33,30 @@
   deriving (Bounded, Enum, Eq, Data, Ord, Read, Show, Ix, Typeable)
 
 instance Hashable OptDir where hashWithSalt = hashUsing fromEnum
+
+#if !MIN_VERSION_hashable(1,2,0)
+-- Copied from hashable-1.2.0.7:
+-- Copyright   :  (c) Milan Straka 2010
+--                (c) Johan Tibell 2011
+--                (c) Bryan O'Sullivan 2011, 2012
+
+-- | Transform a value into a 'Hashable' value, then hash the
+-- transformed value using the given salt.
+--
+-- This is a useful shorthand in cases where a type can easily be
+-- mapped to another type that is already an instance of 'Hashable'.
+-- Example:
+--
+-- > data Foo = Foo | Bar
+-- >          deriving (Enum)
+-- >
+-- > instance Hashable Foo where
+-- >     hashWithSalt = hashUsing fromEnum
+hashUsing :: (Hashable b) =>
+             (a -> b)           -- ^ Transformation function.
+          -> Int                -- ^ Salt.
+          -> a                  -- ^ Value to transform.
+          -> Int
+hashUsing f salt x = hashWithSalt salt (f x)
+{-# INLINE hashUsing #-}
+#endif
