HORIZON HASKELLDocslts/ghc-10.0.x8c2f8e82026-10-19Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8c2f8e8 · 2026-10-19

Moduleopaleye-0.10.8.0Haskell2010

Opaleye.Distinct

  • 1 type
  • 8 values
  • Packageopaleye-0.10.8.0
  • Exports9
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceDistinct.hs
valuedistinct
  1. :: (Default Distinctspec fields fields, Default Unpackspec fields fields)
  2. => Select fields
  3. -> Select fields
#

Remove duplicate rows from the Select.

Example type specialization:

distinct :: Select (Field a, Field b) -> Select (Field a, Field b)

Assuming the makeAdaptorAndInstanceInferrable 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 Select.SelectArrs you should apply Opaleye.Lateral.laterally to it:

Opaleye.Lateral.laterally distinct :: Data.Profunctor.Product.Default Distinctspec fields fields => SelectArr i fields -> SelectArr i fields
valuedistinctOn :: Default Unpackspec b b => (a -> b) -> Select a -> Select a
#

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.

valuedistinctOnBy
  1. :: Default Unpackspec b b
  2. => a -> b
  3. -> Order a
  4. -> Select a
  5. -> Select a
#

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

1 declaration

Adaptors

3 declarations
newtypenewtype Distinctspec a b
#
Instances7Profunctor, ProductProfunctor, SumProfunctor, Default, Functor, Applicative, …

Deprecated

2 declarations