git.iko.soy/typeable/postgresql-simple
on master help sign in
Documentation tweaks
commit1bda1d8b7ef32a01b073138647bd21fa014f58de authorLeon P Smith <leon@melding-monads.com> dateFri 4 May 2012, 19:12 (14 years ago) parent7921281
2 files changed+30−25
CHANGES+18−18 src/Database/PostgreSQL/Simple.hs+12−7
CHANGES+18−18
@@ -1,4 +1,4 @@
1−Version 0.1:
1+Version 0.1: (2012-05-04)
22 * Renamed several modules, typeclasses, and functions:
33
44 QueryParams (renderParams) -> ToRow (toRow)
@@ -6,19 +6,19 @@ Version 0.1:
66 Param (render) -> ToField (toField)
77 Result (convert) -> FromField (fromField)
88
9− * Added the Database.PostgreSQL.Simple.Ok module
10−
9+ * Added the `Database.PostgreSQL.Simple.Ok` module, a variation of
10+ `Either SomeException` that has an instance for `Alternative` and also
11+ uses a list of exceptions to track the ways it has failed.
12+
1113 * Changed the return type of `fromField` and `fromRow` from
12− `Either SomeException` to `Ok`. Either doesn't have an instance for
13− Alternative, and an orphaned instance inside of postgresql-simple is a
14− very bad idea. Also, Ok returns a list of Exceptions so that you can
15− see all the ways it has failed.
16−
17− * Thanks to Ozgun Ataman, the "FromRow" typeclass has been massively
18− improved. The result is simpler definitions and better compositionality.
19− Also, user-defined instances need not be to be concerned about forcing
20− the converted results, as
21−
14+ `Either SomeException` to `Ok`.
15+
16+ * Thanks to suggestions from Ozgun Ataman, the `FromRow` typeclass has been
17+ massively improved. The result is simpler definitions and better
18+ compositionality. Also, user-defined instances need not be to be
19+ concerned about forcing the converted results to WHNF. Here is an
20+ example comparing the old to the new:
21+
2222 instance (Result a, Result b) => QueryResults (a,b) where
2323 convertResults [fa,fb] [va,vb] = do
2424 !a <- convert fa va
@@ -29,14 +29,14 @@ Version 0.1:
2929 instance (FromField a, FromField b) => FromRow (a,b) where
3030 fromRow = (,) <$> field <*> field
3131
32− * Added :., a pair that allows one to compose "FromRow" instances:
33−
32+ * Added `(:.)`, a pair that allows one to compose `FromRow` instances:
33+
3434 instance (FromRow a, FromRow b) => FromRow (a :. b) where
3535 fromRow = (:.) <$> fromRow <*> fromRow
3636
37− * Moved the contents Field module into the "FromField" module.
37+ * Moved the contents `Field` module into the `FromField` module.
3838
3939 * Removed the `RawResult` type.
4040
41− * Added `DefaultIsolationLevel` as a distinct `IsolationLevel` option and
42− `DefaultReadWriteMode as a distinct `ReadWriteMode` option.
41+ * Added `DefaultIsolationLevel` as a distinct `IsolationLevel` option
42+ and `DefaultReadWriteMode` as a distinct `ReadWriteMode`.
src/Database/PostgreSQL/Simple.hs+12−7
@@ -504,23 +504,28 @@ ellipsis bs
504504-- | Of the four isolation levels defined by the SQL standard,
505505-- these are the three levels distinguished by PostgreSQL as of version 9.0.
506506-- See <http://www.postgresql.org/docs/9.1/static/transaction-iso.html>
507−-- for more information.
507+-- for more information. Note that prior to PostgreSQL 9.0, 'RepeatableRead'
508+-- was equivalent to 'Serializable'.
508509
509510data IsolationLevel
510511 = DefaultIsolationLevel -- ^ the isolation level will be taken from
511512 -- PostgreSQL's per-connection
512− -- @default_transaction_isolation@ variable.
513+ -- @default_transaction_isolation@ variable,
514+ -- which is initialized according to the
515+ -- server's config. The default configuration
516+ -- is 'ReadCommitted'.
513517 | ReadCommitted
514518 | RepeatableRead
515− | Serializable -- ^ Note that prior to PostgreSQL 9.0,
516− -- @Serializable@ was equivalent to
517− -- @RepeatableRead@.
519+ | Serializable
518520 deriving (Show, Eq, Ord, Enum, Bounded)
519521
520522data ReadWriteMode
521− = DefaultReadWriteMode -- ^ the isolation level will be taken from the
523+ = DefaultReadWriteMode -- ^ the read-write mode will be taken from
522524 -- PostgreSQL's per-connection
523− -- @default_transaction_read_only@ variable.
525+ -- @default_transaction_read_only@ variable,
526+ -- which is initialized according to the
527+ -- server's config. The default configuration
528+ -- is 'ReadWrite'.
524529 | ReadWrite
525530 | ReadOnly
526531 deriving (Show, Eq, Ord, Enum, Bounded)