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.Internal.Window

  • 3 types
  • 12 values
  • Packageopaleye-0.10.8.0
  • Exports15
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceWindow.hs
newtypenewtype WindowFunction a b
#

WindowFunction represents expressions that contain window functions. You can choose a WindowFunction from the options below, and combine and manipulate them using the Applicative and Profunctor operations.

Instances3Profunctor, Functor, Applicative
valuerunWindows :: Windows a b -> Select a -> Select b
#

runWindows runs a query composed of expressions containing window functions. runWindows is similar to Opaleye.aggregate, with the main difference being that in a window query, each input row corresponds to one output row, whereas aggregation queries fold the entire input query down into a single row per group. In Haskell terminology, Opaleye.aggregate is to foldl as runWindows is to scanl.

datadata Window a
#

In PostgreSQL, window functions must specify the "window" over which they operate. The syntax for this looks like: SUM(salary) OVER (PARTITION BY department). The Opaleye type Window represents the segment consisting of the PARTIION BY.

You can create a Window using partitionBy and combine two Windows in a single one which combines the partition of both by using <>.

Constructors

Instances3Contravariant, Semigroup, Monoid
valuepartitionBy :: (a -> Field_ n b) -> Window a
#

The window where each partition shares the same value for the given Field.

valueorderPartitionBy :: Order a -> Window a
#

Controls the order in which rows are processed by window functions. This does not need to match the ordering of the overall query.