git.iko.soy/typeable/postgresql-simple
on master help sign in
Support for Float, Double, and Rational results
e20ffa2Leon P Smith
src/Database/PostgreSQL/Simple/Result.hs+4−9
@@ -121,22 +121,17 @@ instance Result Int64 where
121instance Result Integer where
121instance Result Integer where
122 convert = atto ok64 $ signed decimal
122 convert = atto ok64 $ signed decimal
123
123
124−{--
125instance Result Float where
124instance Result Float where
126 convert = atto ok (realToFrac <$> double)
125 convert = atto ok (realToFrac <$> double)
127− where ok = mkCompats [Float,Double,Decimal,NewDecimal,Tiny,Short,Int24]
126+ where ok = mkCompats [Float4,Int2]
128
127
129instance Result Double where
128instance Result Double where
130 convert = atto ok double
129 convert = atto ok double
131− where ok = mkCompats [Float,Double,Decimal,NewDecimal,Tiny,Short,Int24,
130+ where ok = mkCompats [Float4,Float8,Int2,Int4]
132− Long]
131+
133−--}
134−{--
135instance Result (Ratio Integer) where
132instance Result (Ratio Integer) where
136 convert = atto ok rational
133 convert = atto ok rational
137− where ok = mkCompats [Float,Double,Decimal,NewDecimal,Tiny,Short,Int24,
134+ where ok = mkCompats [Float4,Float8,Int2,Int4,Numeric]
138− Long,LongLong]
139−--}
140
135
141unBinary (Binary x) = x
136unBinary (Binary x) = x
142
137