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

Modulebeam-core-0.11.1.0Haskell2010

Database.Beam.Query.CTE

Synopsis
newtypenewtype With be (db :: (Type -> Type) -> Type) a

Monad in which SELECT statements can be made (via selecting) and bound to result names for re-use later. This has the advantage of only computing each result once. In SQL, this is translated to a common table expression.

Once introduced, results can be re-used in future queries with reuse.

With is also a member of MonadFix for backends that support recursive CTEs. In this case, you can use mdo or rec notation (with RecursiveDo enabled) to bind result values (again, using reuse) even before they're introduced.

See further documentation here.

Instances4Monad, Functor, MonadFix, Applicative