diff --git a/binary-strict.cabal b/binary-strict.cabal
--- a/binary-strict.cabal
+++ b/binary-strict.cabal
@@ -1,5 +1,5 @@
 name:            binary-strict
-version:         0.2.3
+version:         0.2.4
 license:         BSD3
 license-file:    LICENSE
 author:          Lennart Kolmodin <kolmodin@dtek.chalmers.se>
@@ -17,9 +17,10 @@
 tested-with:     GHC == 6.8.2
 exposed-modules: Data.Binary.Strict.Get,
                  Data.Binary.Strict.IncrementalGet,
-                 Data.Binary.Strict.BitGet
+                 Data.Binary.Strict.BitGet,
+                 Data.Binary.Strict.Util
 extensions:      CPP, FlexibleContexts
 hs-source-dirs:  src
 extra-source-files: tests/BitGetTest.hs, src/Data/Binary/Strict/Common.h
-ghc-options:     -Wall
+ghc-options:     -Wall -fno-warn-name-shadowing
 build-type:      Simple
diff --git a/src/Data/Binary/Strict/BitGet.hs b/src/Data/Binary/Strict/BitGet.hs
--- a/src/Data/Binary/Strict/BitGet.hs
+++ b/src/Data/Binary/Strict/BitGet.hs
@@ -69,8 +69,10 @@
 import GHC.Word
 #endif
 
+#ifndef __HADDOCK__
 data S = S {-# UNPACK #-} !B.ByteString  -- ^ input
            {-# UNPACK #-} !Word8  -- ^ bit offset in current byte
+#endif
 
 newtype BitGet a = BitGet { unGet :: S -> (Either String a, S) }
 
diff --git a/src/Data/Binary/Strict/Get.hs b/src/Data/Binary/Strict/Get.hs
--- a/src/Data/Binary/Strict/Get.hs
+++ b/src/Data/Binary/Strict/Get.hs
@@ -93,8 +93,10 @@
 #endif
 
 -- | The parse state
+#ifndef __HADDOCK__
 data S = S {-# UNPACK #-} !B.ByteString  -- input
            {-# UNPACK #-} !Int  -- bytes read
+#endif
 
 newtype Get a = Get { unGet :: S -> (Either String a, S) }
 
diff --git a/src/Data/Binary/Strict/Util.hs b/src/Data/Binary/Strict/Util.hs
new file mode 100644
--- /dev/null
+++ b/src/Data/Binary/Strict/Util.hs
@@ -0,0 +1,37 @@
+module Data.Binary.Strict.Util
+  ( hexDumpString
+  , hexDump
+  ) where
+
+import Data.List (intersperse)
+
+import qualified Data.ByteString as B
+import qualified Data.ByteString.Char8 as BC
+import Data.ByteString.Internal (w2c)
+import qualified Data.ByteString.Lazy.Char8 as BLC
+
+import Text.Printf (printf)
+
+-- | Convert a strict ByteString to a lazy Char8 ByteString, where the format
+--   is the same as running hexdump -C on it.
+hexDumpString :: B.ByteString -> BLC.ByteString
+hexDumpString = BLC.fromChunks . dumpLine (0 :: Int) where
+  dumpLine offset bs
+    | B.null bs = []
+    | otherwise = line : (dumpLine (offset + 16) $ B.drop 16 bs) where
+        line = s $ a ++ b ++ "  " ++ c ++ padding ++ right ++ newline
+        s = BC.pack
+        a = printf "%08x  " offset
+        b = concat $ intersperse " " $ map (printf "%02x") $ B.unpack $ B.take 8 bs
+        c = concat $ intersperse " " $ map (printf "%02x") $ B.unpack $ B.take 8 $ B.drop 8 bs
+        padding = replicate paddingSize ' '
+        paddingSize = 2 + (16 - (min 16 $ B.length bs)) * 3 - if B.length bs <= 8 then 1 else 0
+        right = map safeChar $ B.unpack $ B.take 16 bs
+        newline = "\n"
+        safeChar c
+          | c >= 32 && c <= 126 = w2c c
+          | otherwise = '.'
+
+-- | Performs the same operation as hexDumpString, but also writes it to stdout
+hexDump :: B.ByteString -> IO ()
+hexDump = BLC.putStr . hexDumpString
