Merge pull request #7 from joeyadams/master

Improve internal type safety, and import GHCi fix from persistent-sqlite.  It is my great pleasure to merge this; I was able to read through it a lot faster than I expected when I saw the list of patches being so long.  Thanks for breaking them up nicely, it made it a lot easier to understand the purpose of things.
Throw an error if # of bind params doesn't the query (#2)

Fail with an error rather than let sqlite convert missing parameters
to NULLs.

Add tests for the above.
Add new modules containing just the bindings and low-level types

This was originally going to be a separate package:

    https://github.com/joeyadams/direct-sqlite-bindings

See that repository for the commit history of these new modules.
Some highlights:

 * FFI bindings are now named like c_sqlite3_prepare_v2 instead of prepareC

 * FFI bindings and low-level types are hyperlinked to their corresponding
   documentation.

 * Used newtypes like CParamIndex and CNumBytes to clarify the meaning of each
   parameter.  This makes the bindings much easier to understand and use
   correctly.

 * The decodeError and decodeColumnType functions in
   Direct.SQLite3.Bindings.Types return Nothing rather than errors.

 * Don't use Int for FFI parameters.  Use CInt instead.

 * But do use Double rather than CDouble, to avoid lossy realToFrac conversions
   when optimization is disabled.

   See http://hackage.haskell.org/trac/ghc/ticket/3676

 * Remove c_sqlite3_bind_int.

   Using this to marshal Haskell's Int type is wrong.
   On 64-bit GHC, Int is 64 bits, while CInt is 32 bits.

   Plus, sqlite3_bind_int is a trivial wrapper that calls sqlite3_bind_int64,
   so this should have no real performance penalty.

 * I was going to give Bounded instances to
   CParamIndex, CColumnIndex, and CColumnCount:

    - CParamIndex:  [1..999]   <http://www.sqlite.org/limits.html#max_variable_number>

    - CColumnIndex: [0..1999]  <http://www.sqlite.org/limits.html#max_column>

    - CColumnCount: [0..2000]  <http://www.sqlite.org/limits.html#max_column>

   However, this would make it tedious to write law-abiding Enum instances,
   which require toEnum, succ, etc. to fail when the input is out of range.
   So for now, these types only get (Eq, Ord, Show).

 * To facilitate conversion to and from the CInt wrappers, I added a collection
   of utility functions that use fromIntegral (which does not throw an error if
   the value is truncated).
Minimally invasive changes to get Database.SQLite3 to build with Database.SQLite3.Bindings

This works, but it doesn't use the new FFI bindings themselves yet.
Rename SQLite3.hsc -> SQLite3.hs, as it no longer needs hsc2hs features
Database.SQLite3: Replace FFI bindings with those in Database.SQLite3..Bindings

Also:

 * Clarify the return value of bindParameterCount, which is not necessarily
  the number of parameters.

 * In bindInt, use sqlite3_bind_int64 instead of sqlite3_bind_int,
   to avoid truncation on platforms where CInt is smaller than Int.
Tiny, but important, fix to documentation of bindParameterName

Parameter indices start from 1, but column indices start from 0.
Copy Database/SQLite3.hs -> Database/SQLite3/Direct.hs
Add Database.SQLite3.Direct, starting from Database.SQLite3
Database.SQLite3.Direct: Organize module header, define Result type, and remove most original code
Rename CParamIndex, CColumnIndex, and CColumnCount so the same types can be used for higher-level APIs
Derive Num and Integral for ParamIndex, ColumnIndex, ColumnCount, and CNumBytes

This sacrifices explicit annotation of arguments in favor of convenience.
But it still, for the most part, retains the basic type safety we want.
Remove unused and misleading Enum instance on CError
Database.SQLite3.Direct: Add type signatures
Database.SQLite3.Direct: Add Utf8 type, and implement 'open'
Database.SQLite3.Direct: Flip arguments of toResult(M) for easier partial application, and implement close
Database.SQLite3.Direct: Implemented errmsg, and finished updating signatures of stubbed functions

Actually, I'll need to annotate results with error information as I go
(e.g. IO Statement becomes IO (Result Statement)).
Database.SQLite3.Direct: Implemented prepare, step, reset, and finalize
Database.SQLite3.Direct: Updated more signatures, and implemented a few more bindings
Add ErrorUnknown, so decodeError is a total function