[Haskell-cafe] custom SQL-to-Haskell type conversion in HDBC
allbery.b at gmail.com
Sat Aug 20 21:43:01 CEST 2011
On Sat, Aug 20, 2011 at 11:01, Henry House <hajhouse at hajhouse.org> wrote:
> > So you want display format data instead of something that you can do
> > computations with? HDBC is giving you the latter; the precision is
> > for computation, although it could be argued that a Fixed type would be
> > better if you intend to propagate exact precision through operations.
> > said, I believe Fixed obeys exact mathematical precision instead of
> > replicating your SQL backend's limitations, so you'd be unhappy again in
> > case of multiplication or division.)
> No, I want a data type in Haskell that mirrors the data type in the
> RDBMS, not conversion of RDBMS fixed-precision data into something else
> (Rational). If the data in the RDBMS represented a rational number of
OK, so you want my other suggestion (Data.Fixed). I don't know how
difficult it would be to add support into HDBC, or how many problems you'll
run into using it because other functions you might need are too specialized
(that is, you'd need to marshal to/from Rational anyway, or write your own
Fixed implementations). I found it a bit painful last time I used it, but
the GHC ecosystem has evolved considerably since then (I was using GHC 6.6).
At least it now has more than just Nano and Pico precisions predefined....
brandon s allbery allbery.b at gmail.com
wandering unix systems administrator (available) (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe