HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

  • Packageopaleye-0.10.8.0
  • Exports81
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceOperators.hs

Restriction operators

valuewhere_ :: Field SqlBool -> Select ()

Keep only the rows of a query satisfying a given condition, using an SQL WHERE clause. It is equivalent to the Haskell function

where_ :: Bool -> [()]
where_ True  = [()]
where_ False = []

Numerical operators

Numeric Column / Field types are instances of Num and Fractional, so you can use the standard Haskell numerical operators (e.g.. *, /, +, -) on them and you can create them with numerical literals such as 3.14 :: Field SqlFloat8.

method(+) :: a -> a -> a
#
method(-) :: a -> a -> a
#
method(*) :: a -> a -> a
#
method(/) :: a -> a -> a

Fractional division.

methodsignum :: a -> a

Sign of a number. The functions abs and signum should satisfy the law:

abs x * signum x == x

For real numbers, the signum is either -1 (negative), 0 (zero) or 1 (positive).

Equality operators

value(.===) :: Default EqPP fields fields => fields -> fields -> Field SqlBool

A polymorphic equality operator that works for all types that you have run makeAdaptorAndInstanceInferrable on. This may be unified with .== in a future version.

value(./==) :: Default EqPP fields fields => fields -> fields -> Field SqlBool

A polymorphic inequality operator that works for all types that you have run makeAdaptorAndInstanceInferrable on. This may be unified with ./= in a future version.

Comparison operators

Numerical operators

valuerem_ :: SqlIntegral a => Field a -> Field a -> Field a

The remainder of integral division, named after rem. It maps to MOD (%) in Postgres, confusingly described as "modulo (remainder)".

Conditional operators

Logical operators

Text operators

Containment operators

valuein_ :: Foldable f => f (Field a) -> Field a -> Field SqlBool

in_ is designed to be used in prefix form.

in_ validUsers user checks whether user is a valid user. in_ validUsers is a function which checks whether a user is a valid user.

valueinMany
  1. :: (Foldable f, Default EqPP fields fields)
  2. => f fields
  3. -> fields
  4. -> Field SqlBool

inMany is a generalization of in_ to values with multiple fields. It is designed to be used in prefix form.

inMany validUsers user checks whether user is a valid user. inMany validUsers is a function which checks whether a user is a valid user.

JSON operators

classclass SqlIsJson json

Class of Postgres types that represent json values. Used to overload functions and operators that work on both SqlJson and SqlJsonb.

Warning: making additional instances of this class can lead to broken code!

Instances2SqlIsJson
classclass SqlJsonIndex a

Class of Postgres types that can be used to index json values.

Warning: making additional instances of this class can lead to broken code!

Instances3SqlJsonIndex

SqlArray operators

Range operators

Other operators

classclass IntervalNum from to | from -> to

IntervalNum from to determines from which date or time types an interval can be added (addInterval) or subtracted (minusInterval) and which is the resulting type.

The instances should correspond to the interval + and - operations listed in:

https://www.postgresql.org/docs/current/functions-datetime.html#OPERATORS-DATETIME-TABLE

Instances5IntervalNum

Deprecated