diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -1,5 +1,7 @@
 # phash: Haskell bindings to pHash, the open source perceptual hash library
 
+[![Build Status](https://travis-ci.org/MichaelXavier/phash.svg?branch=master)](https://travis-ci.org/MichaelXavier/phash)
+
 PHash is a library for generating perceptual hashes of media files. These
 bindings currently only support images. You can compare these hashes to detect
 visually similar images.
diff --git a/phash.cabal b/phash.cabal
--- a/phash.cabal
+++ b/phash.cabal
@@ -1,5 +1,5 @@
 name:               phash
-version:            0.0.2
+version:            0.0.3
 synopsis:           Haskell bindings to pHash, the open source perceptual hash library
 description:        See http://www.phash.org/ for more info. Note that you
                     must have libphash installed on your system to use this
@@ -20,7 +20,7 @@
   exposed-modules:  Data.PHash
   exposed-modules:  Data.PHash.Image
   exposed-modules:  Data.PHash.Types
-  build-depends:    base >= 4.6 && < 4.7
+  build-depends:    base >= 4.6 && < 4.8
   hs-source-dirs:   src
   default-language: Haskell2010
   extra-libraries:  pHash
@@ -31,12 +31,23 @@
   default-language: Haskell2010
   hs-source-dirs:   src, test
   extra-libraries:  pHash
-  build-depends:    base >= 4.6 && < 4.7
+  build-depends:    base >= 4.6 && < 4.8
   build-depends:    tasty >= 0.7 && < 1.0
   build-depends:    tasty-smallcheck >= 0.2 && < 1.0
   build-depends:    tasty-hunit >= 0.4.1 && < 1.0
   build-depends:    HUnit >= 1.2.5.2 && < 2.0
   build-depends:    smallcheck
+
+test-suite docs
+  type:             exitcode-stdio-1.0
+  main-is:          DocTest.hs
+  default-language: Haskell2010
+  hs-source-dirs:   src, test
+  extra-libraries:  pHash
+  ghc-options:      -threaded
+  build-depends:    base >= 4.6 && < 4.8
+  build-depends:    doctest >= 0.9.10 && < 1.0
+  build-depends:    phash
 
 source-repository head
   Type:     git
diff --git a/src/Data/PHash.hs b/src/Data/PHash.hs
--- a/src/Data/PHash.hs
+++ b/src/Data/PHash.hs
@@ -11,8 +11,17 @@
 import Data.PHash.Image
 import Data.PHash.Types
 
--- |Calculate the distance between two hashes. This can be used to detect how
--- similar two images are.
+{-|
+Calculate the distance between two hashes. This can be used to detect how
+similar two images are.
+
+>>> import Data.PHash
+>>> hammingDistance (PHash 15243782418149777067) (PHash 17549625427362946731)
+2
+
+>>> hammingDistance (PHash 15243782418149777067) (PHash 15243782418149777067)
+0
+-}
 hammingDistance :: PHash -> PHash -> Int
 hammingDistance x y = unwrap $ c_ph_hamming_distance (toCPHash x) (toCPHash y)
   where unwrap (CInt i) = fromIntegral i
@@ -29,3 +38,4 @@
   where checkDistance h1 h2 = (<=threshold) $ hammingDistance h1 h2
 
 foreign import ccall "pHash.h ph_hamming_distance" c_ph_hamming_distance :: CULong -> CULong -> CInt
+
diff --git a/src/Data/PHash/Image.hs b/src/Data/PHash/Image.hs
--- a/src/Data/PHash/Image.hs
+++ b/src/Data/PHash/Image.hs
@@ -8,9 +8,21 @@
 
 import Data.PHash.Types
 
--- |Obtain the hash of an image. Returns Nothing on failure. pHash's API does
--- not provide any error information when this fails, but CImg may dump
--- something to stderr.
+-- $setup
+-- >>> let imgPath = "test/fixtures/grump.jpg"
+-- >>> let bogusPath = "bogus"
+
+{-|
+Obtain the hash of an image. Returns Nothing on failure. pHash's API does
+not provide any error information when this fails, but CImg may dump
+something to stderr.
+
+Examples:
+
+>>> import Data.PHash
+>>> imageHash imgPath
+Just (PHash 17549625427362946731)
+-}
 imageHash :: FilePath -> IO (Maybe PHash)
 imageHash path = withCString path $ \cs ->
   with startingPhash $ \pHPtr -> do
diff --git a/test/DocTest.hs b/test/DocTest.hs
new file mode 100644
--- /dev/null
+++ b/test/DocTest.hs
@@ -0,0 +1,5 @@
+import Test.DocTest
+
+main = doctest [ "-isrc"
+               , "-lpHash"
+               , "src/Data/PHash.hs" ]
diff --git a/test/Test.hs b/test/Test.hs
--- a/test/Test.hs
+++ b/test/Test.hs
@@ -48,8 +48,8 @@
 hammingTests = testGroup "hammingTests" [
   testProperty "hammingDistance a a = 0" $
     \ph -> hammingDistance ph ph == 0,
-  testProperty "hammingDistance a a+1 /= 0" $
-    \ph -> hammingDistance ph (ph + 1) /= 0
+  testProperty "hammingDistance a b where a /= b /= 0" $
+    \ph ph' -> ph /= ph' ==> hammingDistance ph ph' /= 0
   ]
 
 instance Monad m => Serial m PHash where
