opaleye-0.6.7000.0: An SQL-generating DSL targeting PostgreSQL

Safe HaskellNone
LanguageHaskell2010

Opaleye.Binary

Contents

Description

Binary relational operations on Selects, that is, operations which take two Selects as arguments and return a single Select.

All the binary relational operations have the same type specializations. For example:

unionAll :: S.Select (Column a, Column b)
         -> S.Select (Column a, Column b)
         -> S.Select (Column a, Column b)

Assuming the makeAdaptorAndInstance splice has been run for the product type Foo:

unionAll :: S.Select (Foo (Column a) (Column b) (Column c))
         -> S.Select (Foo (Column a) (Column b) (Column c))
         -> S.Select (Foo (Column a) (Column b) (Column c))

Please note that by design there are no binary relational functions of type S.SelectArr a b -> S.SelectArr a b -> S.SelectArr a b. Such functions would allow violation of SQL's scoping rules and lead to invalid queries.

unionAll is very close to being the <|> operator of a Control.Applicative.Alternative instance but it fails to work only because of the typeclass constraint it has.

Synopsis

Binary operations

unionAll :: Default Binaryspec fields fields => Select fields -> Select fields -> Select fields Source #

union :: Default Binaryspec fields fields => Select fields -> Select fields -> Select fields Source #

The same as unionAll, except that it additionally removes any duplicate rows.

intersectAll :: Default Binaryspec fields fields => Select fields -> Select fields -> Select fields Source #

intersect :: Default Binaryspec fields fields => Select fields -> Select fields -> Select fields Source #

The same as intersectAll, except that it additionally removes any duplicate rows.

exceptAll :: Default Binaryspec fields fields => Select fields -> Select fields -> Select fields Source #

except :: Default Binaryspec fields fields => Select fields -> Select fields -> Select fields Source #

The same as exceptAll, except that it additionally removes any duplicate rows.

Explicit versions

unionAllExplicit :: Binaryspec fields fields' -> Select fields -> Select fields -> Select fields' Source #

unionExplicit :: Binaryspec fields fields' -> Select fields -> Select fields -> Select fields' Source #

intersectAllExplicit :: Binaryspec fields fields' -> Select fields -> Select fields -> Select fields' Source #

intersectExplicit :: Binaryspec fields fields' -> Select fields -> Select fields -> Select fields' Source #

exceptAllExplicit :: Binaryspec fields fields' -> Select fields -> Select fields -> Select fields' Source #

exceptExplicit :: Binaryspec fields fields' -> Select fields -> Select fields -> Select fields' Source #