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

  • Packageopaleye-0.10.8.0
  • Exports19
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceWindow.hs

Run window functions on a Select

1 declaration
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.

Create Windows

2 declarations
newtypenewtype Windows a b
#

You can create Windows using over, and combine and manipulate them using the Applicative and Profunctor operations.

Instances3Profunctor, Functor, Applicative

Create a Window

2 declarations
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 <>.

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

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

Create a WindowFunction

1 declaration
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

Window functions

13 declarations