diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2016-11-05 0.7.1.0 release prepared by Ryan Mulligan @ryantm
+
+	* Debug flag. Add Debug flag to cabal file to ease debugging by
+	tracing each type of call to the mysql library. By @kakkun61.
+
+2016-08-25 0.7.0.0 release prepared by Ryan Mulligan @ryantm
+
+	* Support and requirement for GHC 8.0.1 added. By @ryantm and @wahjava.
+	* Specify previously required by unspecified dependencies on ssl and zlib.
+
+2016-08-25 0.6.6.4 release prepared by Ryan Mulligan @ryantm
+
+	* Specifically require GHC to be less than version 8.0.1 to avoid
+	problems with cabal interface conflicts.
+
 2010-06-01  Chris Waterson  <waterson@maubi.net>
 
 	* Database/HDBC/MySQL/Connection.hsc.  Add runRaw, patch from Rune
diff --git a/Database/HDBC/MySQL/Connection.hsc b/Database/HDBC/MySQL/Connection.hsc
--- a/Database/HDBC/MySQL/Connection.hsc
+++ b/Database/HDBC/MySQL/Connection.hsc
@@ -1,4 +1,4 @@
-{-# LANGUAGE EmptyDataDecls, ForeignFunctionInterface, ScopedTypeVariables #-}
+{-# LANGUAGE EmptyDataDecls, ForeignFunctionInterface, ScopedTypeVariables, CPP #-}
 
 module Database.HDBC.MySQL.Connection
     (
@@ -23,6 +23,10 @@
 import Database.HDBC.ColTypes as ColTypes
 import Database.HDBC (throwSqlError)
 
+#if DEBUG
+import Debug.Trace
+#endif
+
 #include <mysql.h>
 
 {- | Connection information to use with connectMySQL.
@@ -426,7 +430,7 @@
   buf_ <- new n
   bindOfSqlValue' (8::Int) buf_ #{const MYSQL_TYPE_LONGLONG} Unsigned
 
-bindOfSqlValue (Types.SqlEpochTime epoch) = 
+bindOfSqlValue (Types.SqlEpochTime epoch) =
   bindOfSqlValue (Types.SqlUTCTime t)
     where t = posixSecondsToUTCTime (fromIntegral epoch)
                                             
@@ -800,28 +804,210 @@
 
 {- ---------------------------------------------------------------------- -}
 
+mysql_get_client_info :: IO CString
+mysql_get_client_info =
+#if DEBUG
+  trace "mysql_get_client_info"
+#endif
+    mysql_get_client_info_
+
+mysql_get_server_info :: Ptr MYSQL -> IO CString
+mysql_get_server_info =
+#if DEBUG
+  trace "mysql_get_server_info"
+#endif
+    mysql_get_server_info_
+
+mysql_get_proto_info :: Ptr MYSQL -> IO CUInt
+mysql_get_proto_info =
+#if DEBUG
+  trace "mysql_get_proto_info"
+#endif
+    mysql_get_proto_info_
+
+mysql_init :: Ptr MYSQL -> IO (Ptr MYSQL)
+mysql_init =
+#if DEBUG
+  trace "mysql_init"
+#endif
+    mysql_init_
+
+mysql_options :: Ptr MYSQL -> CInt -> Ptr () -> IO CInt
+mysql_options =
+#if DEBUG
+  trace "mysql_options"
+#endif
+    mysql_options_
+
+mysql_real_connect :: Ptr MYSQL -> CString -> CString -> CString -> CString -> CInt -> CString -> IO (Ptr MYSQL)
+mysql_real_connect =
+#if DEBUG
+  trace "mysql_real_connect"
+#endif
+    mysql_real_connect_
+
+mysql_close :: FunPtr (Ptr MYSQL -> IO ())
+mysql_close =
+#if DEBUG
+  trace "mysql_close"
+#endif
+    mysql_close_
+
+mysql_stmt_init :: Ptr MYSQL -> IO (Ptr MYSQL_STMT)
+mysql_stmt_init =
+#if DEBUG
+  trace "mysql_stmt_init"
+#endif
+    mysql_stmt_init_
+
+mysql_stmt_prepare :: Ptr MYSQL_STMT -> CString -> CInt -> IO CInt
+mysql_stmt_prepare =
+#if DEBUG
+  trace "mysql_stmt_prepare"
+#endif
+    mysql_stmt_prepare_
+
+mysql_stmt_result_metadata :: Ptr MYSQL_STMT -> IO (Ptr MYSQL_RES)
+mysql_stmt_result_metadata =
+#if DEBUG
+  trace "mysql_stmt_result_metadata"
+#endif
+    mysql_stmt_result_metadata_
+
+mysql_stmt_bind_param :: Ptr MYSQL_STMT -> Ptr MYSQL_BIND -> IO CChar
+mysql_stmt_bind_param =
+#if DEBUG
+  trace "mysql_stmt_bind_param"
+#endif
+    mysql_stmt_bind_param_
+
+mysql_stmt_bind_result :: Ptr MYSQL_STMT -> Ptr MYSQL_BIND -> IO CChar
+mysql_stmt_bind_result =
+#if DEBUG
+  trace "mysql_stmt_bind_result"
+#endif
+    mysql_stmt_bind_result_
+
+mysql_stmt_param_count :: Ptr MYSQL_STMT -> IO CULong
+mysql_stmt_param_count =
+#if DEBUG
+  trace "mysql_stmt_param_count"
+#endif
+    mysql_stmt_param_count_
+
+mysql_free_result :: Ptr MYSQL_RES -> IO ()
+mysql_free_result =
+#if DEBUG
+  trace "mysql_free_result"
+#endif
+    mysql_free_result_
+
+mysql_stmt_execute :: Ptr MYSQL_STMT -> IO CInt
+mysql_stmt_execute =
+#if DEBUG
+  trace "mysql_stmt_execute"
+#endif
+    mysql_stmt_execute_
+
+mysql_stmt_affected_rows :: Ptr MYSQL_STMT -> IO CULLong
+mysql_stmt_affected_rows =
+#if DEBUG
+  trace "mysql_stmt_affected_rows"
+#endif
+    mysql_stmt_affected_rows_
+
+mysql_fetch_field :: Ptr MYSQL_RES -> IO (Ptr MYSQL_FIELD)
+mysql_fetch_field =
+#if DEBUG
+  trace "mysql_fetch_field"
+#endif
+    mysql_fetch_field_
+
+mysql_stmt_fetch :: Ptr MYSQL_STMT -> IO CInt
+mysql_stmt_fetch =
+#if DEBUG
+  trace "mysql_stmt_fetch"
+#endif
+    mysql_stmt_fetch_
+
+mysql_stmt_fetch_column :: Ptr MYSQL_STMT -> Ptr MYSQL_BIND -> CUInt -> CULong -> IO CInt
+mysql_stmt_fetch_column =
+#if DEBUG
+  trace "mysql_stmt_fetch_column"
+#endif
+    mysql_stmt_fetch_column_
+
+mysql_stmt_close :: Ptr MYSQL_STMT -> IO ()
+mysql_stmt_close =
+#if DEBUG
+  trace "mysql_stmt_close"
+#endif
+    mysql_stmt_close_
+
+mysql_stmt_errno :: Ptr MYSQL_STMT -> IO CInt
+mysql_stmt_errno =
+#if DEBUG
+  trace "mysql_stmt_errno"
+#endif
+    mysql_stmt_errno_
+
+mysql_stmt_error :: Ptr MYSQL_STMT -> IO CString
+mysql_stmt_error =
+#if DEBUG
+  trace "mysql_stmt_error"
+#endif
+    mysql_stmt_error_
+
+mysql_errno :: Ptr MYSQL -> IO CInt
+mysql_errno =
+#if DEBUG
+  trace "mysql_errno"
+#endif
+    mysql_errno_
+
+mysql_error :: Ptr MYSQL -> IO CString
+mysql_error =
+#if DEBUG
+  trace "mysql_error"
+#endif
+    mysql_error_
+
+mysql_autocommit :: Ptr MYSQL -> CChar -> IO CChar
+mysql_autocommit =
+#if DEBUG
+  trace "mysql_autocommit"
+#endif
+    mysql_autocommit_
+
+mysql_query :: Ptr MYSQL -> CString -> IO CInt
+mysql_query =
+#if DEBUG
+  trace "mysql_query"
+#endif
+    mysql_query_
+
 -- Here are all the FFI imports.
 
-foreign import ccall unsafe mysql_get_client_info
+foreign import ccall unsafe "mysql_get_client_info" mysql_get_client_info_
     :: IO CString
 
-foreign import ccall unsafe mysql_get_server_info
+foreign import ccall unsafe "mysql_get_server_info" mysql_get_server_info_
     :: Ptr MYSQL -> IO CString
 
-foreign import ccall unsafe mysql_get_proto_info
+foreign import ccall unsafe "mysql_get_proto_info" mysql_get_proto_info_
     :: Ptr MYSQL -> IO CUInt
 
-foreign import ccall unsafe mysql_init
+foreign import ccall unsafe "mysql_init" mysql_init_
  :: Ptr MYSQL
  -> IO (Ptr MYSQL)
 
-foreign import ccall unsafe mysql_options
+foreign import ccall unsafe "mysql_options" mysql_options_
  :: Ptr MYSQL
  -> CInt
  -> Ptr ()
  -> IO CInt
 
-foreign import ccall unsafe mysql_real_connect
+foreign import ccall unsafe "mysql_real_connect" mysql_real_connect_
  :: Ptr MYSQL -- the context
  -> CString   -- hostname
  -> CString   -- username
@@ -831,64 +1017,64 @@
  -> CString   -- unix socket
  -> IO (Ptr MYSQL)
 
-foreign import ccall unsafe "&mysql_close" mysql_close
+foreign import ccall unsafe "&mysql_close" mysql_close_
     :: FunPtr (Ptr MYSQL -> IO ())
 
-foreign import ccall unsafe mysql_stmt_init
+foreign import ccall unsafe "mysql_stmt_init" mysql_stmt_init_
     :: Ptr MYSQL -> IO (Ptr MYSQL_STMT)
 
-foreign import ccall unsafe mysql_stmt_prepare
+foreign import ccall unsafe "mysql_stmt_prepare" mysql_stmt_prepare_
     :: Ptr MYSQL_STMT -> CString -> CInt -> IO CInt
 
-foreign import ccall unsafe mysql_stmt_result_metadata
+foreign import ccall unsafe "mysql_stmt_result_metadata" mysql_stmt_result_metadata_
     :: Ptr MYSQL_STMT -> IO (Ptr MYSQL_RES)
 
-foreign import ccall unsafe mysql_stmt_bind_param
+foreign import ccall unsafe "mysql_stmt_bind_param" mysql_stmt_bind_param_
     :: Ptr MYSQL_STMT -> Ptr MYSQL_BIND -> IO CChar
 
-foreign import ccall unsafe mysql_stmt_bind_result
+foreign import ccall unsafe "mysql_stmt_bind_result" mysql_stmt_bind_result_
     :: Ptr MYSQL_STMT -> Ptr MYSQL_BIND -> IO CChar
 
-foreign import ccall unsafe mysql_stmt_param_count
+foreign import ccall unsafe "mysql_stmt_param_count" mysql_stmt_param_count_
     :: Ptr MYSQL_STMT -> IO CULong
 
-foreign import ccall unsafe mysql_free_result
+foreign import ccall unsafe "mysql_free_result" mysql_free_result_
     :: Ptr MYSQL_RES -> IO ()
 
-foreign import ccall unsafe mysql_stmt_execute
+foreign import ccall unsafe "mysql_stmt_execute" mysql_stmt_execute_
     :: Ptr MYSQL_STMT -> IO CInt
 
-foreign import ccall unsafe mysql_stmt_affected_rows
+foreign import ccall unsafe "mysql_stmt_affected_rows" mysql_stmt_affected_rows_
     :: Ptr MYSQL_STMT -> IO CULLong
 
-foreign import ccall unsafe mysql_fetch_field
+foreign import ccall unsafe "mysql_fetch_field" mysql_fetch_field_
     :: Ptr MYSQL_RES -> IO (Ptr MYSQL_FIELD)
 
-foreign import ccall unsafe mysql_stmt_fetch
+foreign import ccall unsafe "mysql_stmt_fetch" mysql_stmt_fetch_
     :: Ptr MYSQL_STMT -> IO CInt
 
-foreign import ccall unsafe mysql_stmt_fetch_column
+foreign import ccall unsafe "mysql_stmt_fetch_column" mysql_stmt_fetch_column_
     :: Ptr MYSQL_STMT -> Ptr MYSQL_BIND -> CUInt -> CULong -> IO CInt
 
-foreign import ccall unsafe mysql_stmt_close
+foreign import ccall unsafe "mysql_stmt_close" mysql_stmt_close_
     :: Ptr MYSQL_STMT -> IO ()
 
-foreign import ccall unsafe mysql_stmt_errno
+foreign import ccall unsafe "mysql_stmt_errno" mysql_stmt_errno_
     :: Ptr MYSQL_STMT -> IO CInt
 
-foreign import ccall unsafe mysql_stmt_error
+foreign import ccall unsafe "mysql_stmt_error" mysql_stmt_error_
     :: Ptr MYSQL_STMT -> IO CString
 
-foreign import ccall unsafe mysql_errno
+foreign import ccall unsafe "mysql_errno" mysql_errno_
     :: Ptr MYSQL -> IO CInt
 
-foreign import ccall unsafe mysql_error
+foreign import ccall unsafe "mysql_error" mysql_error_
     :: Ptr MYSQL -> IO CString
 
-foreign import ccall unsafe mysql_autocommit
+foreign import ccall unsafe "mysql_autocommit" mysql_autocommit_
     :: Ptr MYSQL -> CChar -> IO CChar
 
-foreign import ccall unsafe mysql_query
+foreign import ccall unsafe "mysql_query" mysql_query_
     :: Ptr MYSQL -> CString -> IO CInt
 
 foreign import ccall unsafe memset
diff --git a/HDBC-mysql.cabal b/HDBC-mysql.cabal
--- a/HDBC-mysql.cabal
+++ b/HDBC-mysql.cabal
@@ -1,7 +1,7 @@
 name:             HDBC-mysql
 category:         Database
 synopsis:         MySQL driver for HDBC
-version:          0.7.0.0
+version:          0.7.1.0
 stability:        Experimental
 maintainer:       Ryan Mulligan <ryan@ryantm.com>
 author:           Chris Waterson
@@ -25,6 +25,10 @@
                 base >= 4.9 && < 5,
                 Cabal >= 1.24
 
+flag debug
+  description: Enable debug support
+  default:     False
+
 library
   exposed-modules:  Database.HDBC.MySQL
   other-modules:
@@ -37,6 +41,8 @@
                 time,
                 utf8-string
   ghc-options: -Wall
+  if flag(debug)
+    cpp-options:    -DDEBUG
   extra-libraries: z ssl mysqlclient
   default-language: Haskell2010
 
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -1,29 +1,30 @@
-HDBC-mysql
-==========
+#HDBC-mysql
 
 This is a "native" HDBC driver for MySQL that makes use of
 libmysqlclient to communicate with a MySQL server.  By way of
 synopsis:
 
-  import Control.Monad
-  import Database.HDBC
-  import Database.HDBC.MySQL
-  main = do conn <- connectMySQL defaultMySQLConnectInfo {
-                         mysqlHost     = "db1.example.com",
-                         mysqlUser     = "scott",
-                         mysqlPassword = "tiger"
-                      }
+```haskell
+import Control.Monad
+import Database.HDBC
+import Database.HDBC.MySQL
+main = do conn <- connectMySQL defaultMySQLConnectInfo {
+                       mysqlHost     = "db1.example.com",
+                       mysqlUser     = "scott",
+                       mysqlPassword = "tiger"
+                    }
 
-            rows <- quickQuery' conn "SELECT 1 + 1" []
-            forM_ rows $ \row -> putStrLn $ show row
+          rows <- quickQuery' conn "SELECT 1 + 1" []
+          forM_ rows $ \row -> putStrLn $ show row
+```
 
 At the moment, please consider this to be "alpha" software.  As far as
 I can tell, it works.  There are some limitations that you should be
 aware of.
 
-Caveats
-=======
+## Caveats
 
+
   * This works with MySQL server and client libraries 5.0.75.  I
     haven't tried with 4.x nor 5.1.  I suspect that using a server
     version less than 4.1 won't work, due to lack of support for
@@ -71,20 +72,39 @@
   * It probably makes sense to marshall to the SqlByteString type when
     retrieving BLOB data.
 
-Testing
-=======
+## Testing
 
 There's a little test program that runs a query and spews out the
 results.  To compile it,
 
-  ghc -idist/build -L/opt/local/lib/mysql5/mysql -lmysqlclient --make Test
+```
+ghc -idist/build -L/opt/local/lib/mysql5/mysql -lmysqlclient --make Test
+```
 
 I'm still trying to get the Makefile right so that it can build the
 test sources: it's not there yet.  Here's how I've been doing it, for
 now:
 
-  cd testsrc
-  ghc --make -package HUnit -package HDBC -Wall -i../dist/build -i.. -L/opt/local/lib/mysql5/mysql -lmysqlclient -o runtests runtests.hs
+```
+cd testsrc
+ghc --make -package HUnit -package HDBC -Wall -i../dist/build -i.. -L/opt/local/lib/mysql5/mysql -lmysqlclient -o runtests runtests.hs
+```
 
 One issue is that I want the location of the MySQL library to come
 from the configuration data, rather than be hard-coded.
+
+## Developing hdbc-mysql with nix
+
+```
+# Nix shell
+nix-shell -p haskell.packages.ghc801.ghc gcc mysql57 pkgconfig zlib openssl haskellPackages.haddock
+
+# Use Cabal to build
+cabal clean && cabal build
+
+# Build test script
+ghc -idist/build -L/nix/store/vksgj509kdnk3rva0x64qwp21nzrxy9b-mariadb-10.1.16/lib -lmysqlclient --make Test
+
+# Run test script
+./Test
+```
