HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Moduleopaleye-0.10.8.0Haskell2010

Opaleye.Internal.Window

Synopsis
  • 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

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