on dev help sign in
RealFloatB
4dcfe91Eitan Chatav
squeel-postgresql/src/Squeel/PostgreSQL/Statement.hs+18
@@ -215,6 +215,24 @@ instance
215 ceiling = fromIntegerB . unsafeFunction "ceiling"
215 ceiling = fromIntegerB . unsafeFunction "ceiling"
216 floor = fromIntegerB . unsafeFunction "floor"
216 floor = fromIntegerB . unsafeFunction "floor"
217
217
218+instance
219+ ( IntegerOf (Expression params tables ('Required ('NotNull ty)))
220+ ~ (Expression params tables ('Required ('NotNull 'PGInt8)))
221+ , PGNum ty
222+ , PGTyped ty
223+ , PGCast 'PGInt8 ty
224+ , PGCast 'PGNumeric ty
225+ , PGFloating ty
226+ )
227+ => RealFloatB (Expression params tables ('Required ('NotNull ty))) where
228+ isNaN x = x ==* UnsafeExpression "\'NaN\'"
229+ isInfinite x = x ==* UnsafeExpression "\'Infinity\'"
230+ ||* x ==* UnsafeExpression "\'-Infinity\'"
231+ isNegativeZero x = x ==* UnsafeExpression "-0"
232+ isIEEE _ = true
233+ atan2 y x = UnsafeExpression $
234+ "atan2(" <> renderExpression y <> ", " <> renderExpression x <> ")"
235+
218instance IsString (Expression params tables ('Required (nullity 'PGText))) where
236instance IsString (Expression params tables ('Required (nullity 'PGText))) where
219 fromString str = UnsafeExpression $
237 fromString str = UnsafeExpression $
220 "E\'" <> fromString (escape =<< str) <> "\'"
238 "E\'" <> fromString (escape =<< str) <> "\'"