| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Opaleye.Distinct
Synopsis
- distinct :: Default Distinctspec fields fields => Default Unpackspec fields fields => Select fields -> Select fields
- distinctOn :: Default Unpackspec b b => (a -> b) -> Select a -> Select a
- distinctOnBy :: Default Unpackspec b b => (a -> b) -> Order a -> Select a -> Select a
- distinctExplicit :: Unpackspec fields fields -> Distinctspec fields fields' -> Select fields -> Select fields'
- data Distinctspec a b
- distinctspecField :: Distinctspec (Field_ n a) (Field_ n a)
- distinctspecMaybeFields :: WithNulls Distinctspec a b -> Distinctspec (MaybeFields a) (MaybeFields b)
- distinctOnCorrect :: Default Unpackspec b b => (a -> b) -> Select a -> Select a
- distinctOnByCorrect :: Default Unpackspec b b => (a -> b) -> Order a -> Select a -> Select a
Documentation
distinct :: Default Distinctspec fields fields => Default Unpackspec fields fields => Select fields -> Select fields Source #
Remove duplicate rows from the Select.
Example type specialization:
distinct :: Select (Field a, Field b) -> Select (Field a, Field b)
Assuming the makeAdaptorAndInstance splice has been run for the product type Foo:
distinct :: Select (Foo (Field a) (Field b) (Field c)) -> Select (Foo (Field a) (Field b) (Field c))
If you want to run distinct on SelectArrs you should
apply laterally to it:
laterallydistinct::DefaultDistinctspecfields fields =>SelectArri fields ->SelectArri fields
distinctOn :: Default Unpackspec b b => (a -> b) -> Select a -> Select a Source #
Keep a row from each set where the given function returns the same result. No
ordering is guaranteed. Multiple fields may be distinguished by projecting out
tuples of Field_s. Use distinctOnBy to control how the rows
are chosen.
distinctOnBy :: Default Unpackspec b b => (a -> b) -> Order a -> Select a -> Select a Source #
Keep the row from each set where the given function returns the same result. The
row is chosen according to which comes first by the supplied ordering. However, no
output ordering is guaranteed. Multiple fields may be distinguished by projecting
out tuples of Field_s.
Explicit versions
distinctExplicit :: Unpackspec fields fields -> Distinctspec fields fields' -> Select fields -> Select fields' Source #
Adaptors
data Distinctspec a b Source #
Instances
distinctspecField :: Distinctspec (Field_ n a) (Field_ n a) Source #
distinctspecMaybeFields :: WithNulls Distinctspec a b -> Distinctspec (MaybeFields a) (MaybeFields b) Source #
Deprecated
distinctOnCorrect :: Default Unpackspec b b => (a -> b) -> Select a -> Select a Source #
Deprecated: Use distinctOn instead. Will be removed in 0.11.
distinctOnByCorrect :: Default Unpackspec b b => (a -> b) -> Order a -> Select a -> Select a Source #
Deprecated: Use distinctOnBy instead. Will be removed in 0.11.