Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- distinct :: Default Distinctspec 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 :: 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 => 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 SelectArr
s you should
apply laterally
to it:
laterally
distinct
::Default
Distinctspec
fields fields =>SelectArr
i fields ->SelectArr
i 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. Mutliple fields may be distinguished by projecting
out tuples of Field_
s.
Explicit versions
distinctExplicit :: 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 #
Use distinctOn
instead. Will be deprecated in 0.10.
distinctOnByCorrect :: Default Unpackspec b b => (a -> b) -> Order a -> Select a -> Select a Source #
Use distinctOnBy
instead. Will be deprecated in 0.10.