@@ -118,34 +118,57 @@ The ``DBType`` subtypes
121−.. todo::
121+The ``DBEq`` type class represents the subclass of database types that support
122−
122+equality. By supporting equality, we mean that a type supports the ``=``
123− Document this
123+operator, and also has a suitable notion of equality for operations like
124+``GROUP BY`` and ``DISTINCT``. On the one hand, this class is like Haskell's
125+``Eq`` type class. The main difference is that this class has no methods.
128−.. todo::
130+The ``DBOrd`` type class represents the subclass of database types that support
131+the normal comparison operators - ``<``, ``<=``, ``>=`` and ``>``.
133+``DBMax`` and ``DBMin``
134+^^^^^^^^^^^^^^^^^^^^^^^
130− Write this
136+The type classes indicate that a database type supports the ``min()`` and
137+``max()`` aggregation functions.
132``DBSemigroup`` and ``DBMonoid``
139``DBSemigroup`` and ``DBMonoid``
133^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
140^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
135−.. todo::
142+These type classes exist to give Rel8's API a similar feel to Haskell
136−
143+programming. Many database types have a sensible monoid structure, with the
137− Write this
144+presence of a ``mempty``-like expression, and an associative operation to
139``DBNum``, ``DBIntegral`` and ``DBFractional``
147``DBNum``, ``DBIntegral`` and ``DBFractional``
140^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
148^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
142−.. todo::
150+These type classes are used to present a familiar numeric type hierarchy for
144− Write this
153+``DBNum``
154+ This class indicates that a type supports the ``+``, ``-``, and ``*``
155+ operators, along with the ``abs()``, ``negate()`` and ``sign()`` functions.
156+ Database types that are instances of ``DBNum`` allow ``Num (Expr a)`` to be
157+ used (allowing you to combine expressions with Haskell's normal ``+``
161+ If a type is an instance of ``DBIntegral``, it means that the type stores
162+ integral (whole) numbers. The ``Rel8.Expr.Num`` module provides familiar
163+ ``Expr`` functions like ``fromIntegral`` to convert between types.
166+ If a type is an instance of ``DBFraction``, it means that the type supports
167+ the ``/`` operator, and literals can be created via Haskell's ``Rational``
168+ type class. This type class provides the ``Fracitonal (Expr a)`` instance.
146``DBString``
170``DBString``
147^^^^^^^^^^^^
171^^^^^^^^^^^^
149−.. todo::
173+This type class indicates that a database type supports the ``string_agg()``
150−
174+aggregation function.